Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Roles Can Have Pre-Granted Permissions #3334

Closed
hikalkan opened this issue May 7, 2018 · 2 comments
Closed

Static Roles Can Have Pre-Granted Permissions #3334

hikalkan opened this issue May 7, 2018 · 2 comments
Labels
Milestone

Comments

@hikalkan
Copy link
Member

hikalkan commented May 7, 2018

When we define a static role, we may want one of the following additional features:

  • Grant all permissions (including new permissions will be added in the future) to the static role by default (unless it's explicitly prohibited for that role).
  • Grant a list of permissions to the static role by default (unless it's explicitly prohibited for that role).

These configuration should work with the RoleManager seemlessly.

The benefits of this feature:

  • When we introduce a new permission, we don't have to grant it to the static roles manually on the UI.
  • We can define default permissions for all tenant admins from a single point. If we don't allow to change static role permissions on the UI, this can lead to system level frozen permissions for static roles for all tenants.

How to Use

Configuration.Modules.Zero()
    .RoleManagement.StaticRoles.Add(
        new StaticRoleDefinition("admin", MultiTenancySides.Tenant, grantAllPermissionsByDefault: true)
    );

Configuration.Modules.Zero()
    .RoleManagement.StaticRoles.Add(
        new StaticRoleDefinition("moderator", MultiTenancySides.Tenant)
        {
            GrantedPermissions =
            {
                "permission-1",
                "permission-2"
            }
        }
    );
@bbakermmc
Copy link
Contributor

@hikalkan For the static permissions, do we need to seed them to all existing clients if we add new ones? If I just create a new static role, it never shows up in UI. My guess is I would also need to update the Seed for the tenant as well for new tenants to get them.

@ismcagdas
Copy link
Member

do we need to seed them to all existing clients if we add new ones?

@bbakermmc yes, exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants