roles

How to model system with different types of users?

一笑奈何 提交于 2019-12-07 19:18:21
问题 I am working on a restaurant franchise app. I've only ever had to use a User model and has secure password. class User < ActiveRecord::Base has_secure_password Now I would have different types of users with different access rights and reports: franchisor user (head office) restaurant owner / franchisee manager waiter What is a recommended way to set up the models/classes? Would I create a model for each and give each has_secure_password or would I put everyone into the user model and assign

Keycloak User Roles missing in REST API

你。 提交于 2019-12-07 16:38:06
问题 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 seems not very convenient. Maybe I need to map the roles in Admin console or use claims? Roles are one of the most important user attribute so whats the reason they are not retrieved as other user attributes?Any suggestion? Thanks GET /auth/admin

deny custom role

牧云@^-^@ 提交于 2019-12-07 16:02:15
问题 how can i deny access to call method. something like this [HandleError] [Authorize(Roles = "role1, role2")] public class AdminController : Controller { [Deny(Roles = "role2")] public ActionResult ResultPage(string message) { ViewData["message"] = message; return View(); } } 回答1: You could simply do it the other way around and check for the presence of role1 instead of the absence of role2. Alternatively you could develop your own DenyAttribute that does what you want and verifies that the

How to implement a role based user management system with ASP.NET MVC 4

混江龙づ霸主 提交于 2019-12-07 15:03:14
问题 Although I'm new to ASP.NET I have to implement a role based user management system for an ASP.NET MVC 4 application (Visual Studio 2010). Users have one or more of these roles: Admin, Manager, User. Based on the role users have access to different areas. There is a predefined table with users. I know that ASP.NET provides something to implement this requirement but I am confused by the information I get. Even though there is a lot of information I can't find an adequate documentation or blog

Symfony2 - Why voters are called even for SuperAdmins

若如初见. 提交于 2019-12-07 13:26:25
问题 I noticed that my voters are solicited even for SuperAdmin users. Is it working as expected ? If yes, I thought that the philosophy of SuperAdmin is that they systematically have all rights, so that we don't have to give them each permission one by one. In that case why not granting access to all voters ? Do I always have to put if ($user->isSuperAdmin()) { return VoterInterface::ACCESS_GRANTED; } in my voters ? 回答1: In the IddqdVoter class, you have a special role called ROLE_IDDQD . This

Restrict Area to a given role

此生再无相见时 提交于 2019-12-07 07:05:34
问题 I have an area setup in MVC2, called Admin/ , which I want I only want Users who belong to the role "admins" to have access. I know I can decorate each of the methods with [Authorize(Roles="admins")] , but this seems tedious when your talking about multiple controllers with multiple actions. Is there an better and cleaner way? 回答1: You could define a base controller decorated with this attribute that all controllers in the area derive from. 来源: https://stackoverflow.com/questions/3291385

Can someone explain how Postgresql roles, Postgresql users and Linux users relate to each other?

点点圈 提交于 2019-12-07 04:41:20
问题 I am trying to setup Postgres 9.3 on an Ubuntu 14 server, and I'm feeling pretty demoralised at this point. I've previously used MySQL, so I'm happy with general database concepts, as well as client/server models etc. I start with two users - 'root' and 'sam' (me). As 'sam' I install postgresql using apt-get. This also creates a third user called 'postgres'. Fine. I'm told that to use postgres you must be logged in as the postgres user, so I switch to that account. Apparently this comes with

Dynamic generation of RBAC roles and permissions

≡放荡痞女 提交于 2019-12-07 02:28:30
问题 I’m looking for a methodology for generating new RBAC roles on demand. I am developing a RBAC system that will have two primary parameters. Rather than simply having a user associated with a role, and that role associated with a group of permissions; a user can be associated with a role “for a specific project,” and the user can then have the permissions of that role for that project only (or for other projects that the user holds that role for). A user can have a specific role on one project

ASP.net is user in role

試著忘記壹切 提交于 2019-12-07 00:13:26
问题 I'm having trouble working out how to quickly find out yes/no is a username in a role? I've gotten as far as: Roles.FindUsersInRole("Admin", usersName) But am a bit stuck, any easy way of doing this? 回答1: The below returns true or false depending on if the specified user is in the specified role Roles.IsUserInRole(userName, role) So, for example, if you wanted to remove a user from a specific role you could use if (Roles.IsUserInRole(userName, role)) Roles.RemoveUserFromRole(userName, role);

REST, caching, and authorizing with multiple user roles

放肆的年华 提交于 2019-12-06 23:39:45
问题 We have a multi-tenant system with multiple different levels of access--sometimes even for the same user as they switch between multiple roles. We're beginning a discussion on moving over to a RESTful implementation of things. I'm just starting to get my feet wet with the whole REST thing. So how do I go about limiting access to the correct records when they access a resource, particularly when taking caching into consideration? If user A access example.com/employees they would receive a