Looks like the $object.MoRef is $null in a call to the method.
Can you try with the following version of your function ?
It will check if you pass a $null object as the 1st parameter.
function Set-Permission
{
param(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[VMware.Vim.ManagedEntity]$object,
[VMware.Vim.Permission]$permission
)
Begin{
}
Process{
$perms = $authMgr.SetEntityPermissions($object.MoRef,@($permission))
}
End{
return
}
}