Questions tagged [user-roles]

A user role is a group of users that share the same privileges or permissions on a system. Use this tag for questions about how user roles work in a particular security framework, or questions about the implementation of user roles in your program.

A user role is a group of users that share the same privileges or permissions on a system. For example, a blog platform may define a group of platform admins and groups of blog admins, blog editors and blog readers.

The concept is linked to , as a user role is a group of users who share common user permissions. It is common that a system allows users to have several roles, the user then has the union of all the permissions of their roles.

Use this tag for questions about how user roles work in a particular security framework, or questions about the implementation of user roles in your program.

944 questions
132
votes
20 answers

How to check "hasRole" in Java Code with Spring Security?

How to check user authority or permission in Java Code ? For example - I want to show or hide button for user depending on role. There are annotations like: @PreAuthorize("hasRole('ROLE_USER')") How to make it in Java code? Something like :…
Piotr Gwiazda
  • 12,080
  • 13
  • 60
  • 91
57
votes
4 answers

Get user role by ID WordPress

I need to somehow check someone's role with only their id. I have found the current_user_can() check. But this only works for people that are logged in. How would I check for this if that user isn't the current user? I am using a phone order system…
Tristan .L
  • 829
  • 3
  • 9
  • 20
32
votes
9 answers

AngularJS, ui.router, load template and controller based on user role

I have developed a Single Page App that uses a REST api. Users are required to login to access the application. When a user logs in they are redirected to /dashboard. On this URL / route, I would like to load a different template and controller…
31
votes
3 answers

ASP.NET MVC Check role inside view

In my View I have some admin links that I would like to hide and show based on user role how can do this inside the view e.g. <%= if(CHECK IF USER ROLE ADMIN) { %>
  • <%=…
Cameron
  • 27,963
  • 100
  • 281
  • 483
30
votes
2 answers

Get role/s of current logged in user in ASP.NET Core MVC

How can I get the logged in user's role/s in ASP.NET Core MVC? I want to get role details as soon as user logs in into the application, but by using following code I am not able to retrieve the role details public async Task
XamDev
  • 3,377
  • 12
  • 58
  • 97
29
votes
1 answer

How to permit a SQL Server user to insert/update/delete data, but not alter schema?

My application (C#, ASP.Net) needs to insert, update and delete data in the DB, and run stored procedures. I need to prevent it from modifying the DB schema - no altering tables, creating or dropping, no changes to stored procedures. What…
jprusakova
  • 1,557
  • 3
  • 19
  • 31
28
votes
5 answers

how to create duplicate role of a user in postgres

I need a new user but it should be granted all those privileges that the other existing user/role has. e.g. User A has SELECT privileges on Table1 User A has EXECUTE privileges on Table2 ... If a new User B is created, I need the same privileges…
UserBSS1
  • 2,091
  • 1
  • 28
  • 31
27
votes
3 answers

How would you manage user roles and permissions using Angular 2

I'm working on a new Angular2 app, and I was wondering how would you manage routes accessible to certain roles and permissions to create, edit, and delete items for certain roles. I want to know how do you solve the problem such this: How do you…
Roman Skydan
  • 5,478
  • 4
  • 19
  • 39
23
votes
2 answers

Working with user roles in Django

I have some question In a project I have the need of work with users which are of three (may be more) types of them have different roles: physician patient administrator I have been thinking use of the Django Model Users and extend it creating a…
bgarcial
  • 2,915
  • 10
  • 56
  • 123
23
votes
2 answers

How can I grant only READ access to a Single table in Sql Server Database

I want to provide only READ access to a single table in SQL Server Database for a given user - xyz Have gone through these questions: How do I grant read access for a user to a database in SQL Server? Granting a SQL Server Login Access to a Database…
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
23
votes
1 answer

CouchDB-wide read-only access rights

I need to create a CouchDB user which can only read documents from any database but can't write any of them. As far as I'm concerned, it is not what is supported by default (user types are described here). As the wiki says, access rights are given…
Sergey Savenko
  • 666
  • 6
  • 11
21
votes
4 answers

Keycloak User Roles missing in REST API

I would like to ask, if somebody knows, why there are no roles within the user details in REST ADMIN API request. I saw some posts dealing with this topic, but there were either no clear answer or they propose to use keycloak-admin-client, but that…
troger19
  • 1,159
  • 2
  • 12
  • 29
21
votes
2 answers

What names for standard website user roles?

What are the standard user role names that a majority of sites could all use? Below is a list of the best roles that I could think of (in order of importance), but I am hoping to find at least ten role names for a user system I am working on. admin:…
Xeoncross
  • 55,620
  • 80
  • 262
  • 364
20
votes
3 answers

ASP.NET Core Identity Add custom user roles on application startup

In an ASP.NET Core application, I want to create certain roles as a basis to manage different user-permissions. Sadly, the documentation inform detailled how to use custom roles e.g. in controllers/actions, but not how to create them. I found out…
Lion
  • 16,606
  • 23
  • 86
  • 148
19
votes
7 answers

T-SQL to list all the user mappings with database roles/permissions for a Login

I am looking for a t-sql script which can list the databases and and the respective roles/privileges mapped for a particular user. Using SQL Server 2008 R2.
muddu83
  • 465
  • 2
  • 7
  • 17
1
2 3
62 63