Apply Inherited Permissions

Resolved

Apply Inherited Permissions

avatar

I'm using the following code to set specific permissions to new credential entries.

            if($ViewPermissionGroup -ne $null) {
                $cr.Security.RoleOverride = "Custom"
                $cr.Security.ViewOverride = "Custom"
                $cr.Security.ViewRoles = $ViewPermissionGroup
            }

This works great when $ViewPermissionGroup is defined. However, all other credentials aren't inheriting the correct permissions.

I've tried setting $cr.Security.RoleOverride to "Default" and "Inherited" with the same wrong results. The new entry does not inherit the permissions from the vault/folder.

Is there some way to getting new entries the inherited vault/folder permissions instead of "Custom"?

I didn't see anything in the example scripts on how to do this.

Thanks,

Chris

All Comments (4)

avatar

Hello,

What data source type are you connected to?

What Devolutions.PowerShell module version are you using?

The following sample should work as expected to set permission to Inherited.

$session.Security.RoleOverride = 'Default'
Set-RDMSession $session -Refresh


Best regards,

Érica Poirier

avatar

Setting it to "Default" worked. There is some typing weirdness in PowerShell where the $null check was still being successful despite not being provided.

Thanks for the help.

Chris

avatar

Hello,

Thank you for your feedback, and I'm glad that it's working.

About the $null validation, maybe using this method could provide better results. It tests if the content of the variable is not null or empty.
if (![string]::IsNullOrEmpty($ViewPermissionGroup))

Best regards,

Érica Poirier

avatar

Ah, thanks for that. It seemed odd there wasn't a way to simplify that check.

Thanks!