I am using ServiceStack
and have started to add role based authorization to my service. From the documentation I can see there are services to assign and remove roles from a user via the web service.
My question is are there any built-in services included in ServiceStack to query the roles and permissions the user currently has?
A permission grants users the ability to perform an action on a resource in the WorkMarket platform. A role is a set of one or more permissions and can be assigned to a user to grant a set of permissions.
Three main types of access control systems are: Discretionary Access Control (DAC), Role Based Access Control (RBAC), and Mandatory Access Control (MAC).
Authorization means determining whether that user, server, or client as permission to do something. Permissions are settings on a file or other object that define who or what is allowed to use it and what they are allowed to do with it.
User Roles give Administrators the ability to control what users can do within the system, without giving full administrator access. A Role is a collection of Permissions which could be based on a job function. Permissions are assigned to Roles and Roles are assigned to Users.
There is no built-in Service in ServiceStack that returns Users Roles and Permissions, but it's easy enough to create your own custom Service to do this, e.g you can read it from the session with something like:
public class MyService : Service {
public object Get(UserRoles request) {
var session = this.GetSession();
return new UserRolesResponse {
Roles = session.Roles,
Permissions = session.Permissions,
};
}
}
For an example of an Admin service to return all users Auth details see the SocialBoostrap UserAuths Service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With