Hi,
how can I retrieve all available roles and permissions inside a service?
Greetings
Andre
Hi,
how can I retrieve all available roles and permissions inside a service?
Greetings
Andre
Hi @mauve,
It will likely depend how you are using roles and permissions. Is this all services in an AppHost or for a single endpoint? Are you using declarative validation for required roles (eg attributes like RequiresAnyRole
)? Are you using UseDistinctRolesTables = true
in your OrmLiteAutoRepository
registration?
For all roles in your AppHost you can probably use HostContext.Metadata.GetAllRoles()
and HostContext.Metadata.GetAllPermissions()
, for a specific service you can get attribute information by using HostContext.Metadata.GetOperation(requestType).RequiredRoles
, RequiresAnyRole
, and same for Permissions.
If you can share any more info about what you are trying to achieve, might be able to suggest other methods more specific to your situation.
helps in my case