Sample: Add, remove, or get a role from another role
This Sitecore.Security.Accounts.RolesInRolesManager class describes how .NET APIs operate with roles in roles.
Add a role to a role
Add a role to a role
You can add an existing role to another existing role using the Sitecore.Security.Accounts.RolesInRolesManager.AddRoleToRole(Role memberRoles, Role targetRoles) method. The first parameter is a member role and the second parameter is a target role.
To assign a role to another role:
Remove a role from a role
Remove a role from a role
You can remove an existing role from another existing role using the Sitecore.Security.Accounts.RolesInRolesManager.RemoveRoleFromRole(Role memberRoles, Role targetRoles) method. The first parameter is a member role and the second parameter is a target role.
Get a role from a role
Get a role from a role
You can get an existing role from another existing role using the Sitecore.Security.Accounts.RolesInRolesManager.GetRolesInRole(Role targetRole, bool includeIndirectMembership) method. The first parameter is a role and the second parameter determines whether you need indirect membership.
To get a role from another role: