roles

Implementing role-based authorization using .NET MVC 5

情到浓时终转凉″ 提交于 2019-12-09 12:44:46
问题 I would like to implement a role-based authorization in my web application that I'm building. The way I imagined to make this is to create 3 tables in my DB like following: 1. Roles 2. UserRoles (many to many table) 3. Users After that each user would have a role assigned to him. Now... My question is, How do I permit or forbid access to specific views/controllers inside my .NET MVC application. I've stumbled upon this: [Authorize(Roles = "HrAdmin, CanEnterPayroll")] [HttpPost] public

Ansible - Define Inventory at run time

故事扮演 提交于 2019-12-09 07:03:33
问题 I am liitle new to ansible so bear with me if my questions are a bit basic. Scenario: I have a few group of Remote hosts such as [EPCs] [Clients] and [Testers] I am able to configure them just the way I want them to be. Problem: I need to write a playbook, which when runs, asks the user for the inventory at run time. As an example when a playbook is run the user should be prompted in the following way: "Enter the number of EPCs you want to configure" "Enter the number of clients you want to

HttpContext.GetOwinContext().GetUserManager<AppRoleManager>() return null

只谈情不闲聊 提交于 2019-12-09 04:38:44
问题 I've used ASP.NET Identity 2 for creating role but the result of HttpContext.GetOwinContext().GetUserManager<AppRoleManager>() was null. Then I couldn't create the role. How can I solve this problem? public class MVCController : Controller { public MVCController() { } public AppRoleManager RoleManager // returns null ?! { get { return HttpContext.GetOwinContext().GetUserManager<AppRoleManager>(); } } public User CurrentUser { get { string currentUserId = User.Identity.GetUserId(); User

Preferred database design method for assigning user roles? (Hats vs. Groups)

帅比萌擦擦* 提交于 2019-12-09 04:08:14
问题 I have medium sized MySQL database with a primary "persons" table which contains basic contact information about every human being connected to the theatre and theatre school for which I am responsible for maintaining and developing a number of web applications. Some persons are just contacts - that is, their "persons" table record is all the information we need to store about them. Many others though have to be able to assume different roles for a variety of systems. Of these, most start out

Common CMS roles and access levels

痴心易碎 提交于 2019-12-09 04:03:47
问题 I am currently writing a CMS and remember someone (it might have been on here) criticise the existing CMS for not having a robust enough user permissions system. I've got a method planned out but it I feel it has fallen into the usual trap of being a bit too fine-grained which makes understanding and implementing it a horror for end users. I think having a range of default user roles with permissions would be the answer to this, so I suppose my question is this: What are the default roles you

User.IsInRole return false

风流意气都作罢 提交于 2019-12-08 19:14:43
问题 I 'm using Identity 2 for authentication in mvc 5 web site. In my view i want check the role of the user : @if(User.IsInRole("Customers")) { @*do something*@ } but this always return false, I have already set <roleManager enabled="true" /> in the web config. any help please. 回答1: I just got it to work with my setup that is also using Identity Framework. I added a user to a role by using the following code: this.RoleManager.CreateAsync(new Role() {Name = "Customers"}); this.UserManager

Recursive roles with custom user provider entity

醉酒当歌 提交于 2019-12-08 10:42:27
问题 I've got a custom user provider entity which permits me to connect the users. This custom user provider entity implements UserInterface in accordance to this interface I've got a "getRoles()" function which give me the user's roles. But my roles are recursive. Example: a user got a role1, the role1 inherited the role2 so the user has gotten the role1 and the role2. To make this recursivity I create a role table, a role_role table (parent/child), a user table and finally a user_role table. To

how to relate roles in filter attribute with my database?

本小妞迷上赌 提交于 2019-12-08 10:37:00
问题 What's the data source Asp.net MVC uses to see if the user is in which role. And how can i change it so that it works with my own database table (when i write [Autorize(Roles="admin")] it checks in the table if the user is in the role ) 回答1: What's the data source Asp.net MVC uses to see if the user is in which role. It uses the RoleProvider that is configured in your web.config. If you want to use custom tables you could write a custom role provider by inheriting from the RoleProvider class

Role-based access control - should I have the permission list in the db as well or just in the code (eg enum)?

旧巷老猫 提交于 2019-12-08 10:17:22
问题 Generally when implementing some sort of role based access control, we have the following well-known concepts: Role User Permission And users would be assigned to roles each of which have a set of permissions (to perform an operation / access a resource etc). So users gain permissions to perform operations by being assigned to one or more roles (which have been assigned a set of permissions). In any given application, permissions are defined at compile time since the code actually enforces

How create role to put in the database?

此生再无相见时 提交于 2019-12-08 07:56:41
问题 i wish create a role for each user after that the user authenticate(login) to access to the application i will give some role to and save the role on the database. I will make an example with the database "aspnet.mdf" and Linq toSql to store data but before i need know how create role in c#(WPF) and after created i wish add roles on the database so doing i can assign for each user the right role that i wish . DO you have some idea how do it right??? I will use the database "aspnet.mdf" as