How can an Orchard Core module add new roles and permissions?

424 Views Asked by At

IPermissionProvider doesn't seem to be able to add new roles (maybe I missed something), and it also seems to only be called during the module's initial installation, which seems batty.

How can my module add new roles and permissions?

1

There are 1 best solutions below

3
Dean Marcussen On BEST ANSWER

IPermissionProvider implements two methods which you can implement.

  • Task<IEnumerable<Permission>> GetPermissionsAsync() which allows your module to return a Permission which your module provides, and

  • IEnumerable<PermissionStereotype> GetDefaultStereotypes() which allows you to define what of the permissions you have created will have by default, and/or add a PermissionStereotype to define a new role.