roles

Can I hide/show asp:Menu items based on role?

痴心易碎 提交于 2019-11-27 11:48:11
Am I able to hide certain menu items in an asp:Menu control based on role? <asp:Menu ID="mTopMenu" runat="server" Orientation="Horizontal" /> <Items> <asp:MenuItem Text="File"> <asp:MenuItem Text="New Project" /> <asp:MenuItem Text="Release Template" NavigateUrl="~/Release/ReleaseTemplate.aspx" /> <asp:MenuItem Text="Release Schedule" NavigateUrl="~/Release/ReleaseSchedule.aspx" /> <asp:MenuItem Text="Roles" NavigateUrl="~/Admin/AdminRoles.aspx" /> </asp:MenuItem> </Items> </asp:Menu> How can I make one of these items visible to only users in the Admin role? I am using asp.net role provider.

Angular2 routing canActivate and AuthGuard (JWT) with user role parameter

末鹿安然 提交于 2019-11-27 10:16:02
问题 In this exaple project with JWT authentication we se how to allow only authenticated users to some route: import { RouterConfig } from '@angular/router'; import { Home } from './home'; import { Login } from './login'; import { Signup } from './signup'; import { AuthGuard } from './common/auth.guard'; export const routes: RouterConfig = [ { path: '', component: Login }, { path: 'login', component: Login }, { path: 'signup', component: Signup }, { path: 'home', component: Home, canActivate:

Group vs role (Any real difference?)

╄→尐↘猪︶ㄣ 提交于 2019-11-27 08:57:54
问题 Can anyone tell me, what's the real difference between group and role? I've been trying to figure this out for some time now and the more information I read, the more I get the sense that this is brought up just to confuse people and there is no real difference. Both can do the other's job. I've always used a group to manage users and their access rights. Recently, I've come across an administration software, where is a bunch of users. Each user can have assigned a module (whole system is

Find out if someone has a role

风流意气都作罢 提交于 2019-11-27 06:14:06
问题 I made a simple quote bot for a server, but the admin only wants mod+ people to be able to add quotes to avoid spam. I went to the documentation and did everything, but I can't get this to work. Here's what I have: //other code else if (command === "addquote" && arg) { let adminRole = message.guild.roles.find("name", "Admin"); let modRole = message.guild.roles.find("name", "Mod"); if(message.member.roles.has(adminRole) || message.member.roles.has(modRole)){ const hasArr = arr.some((el) => {

Allow multiple roles to access controller action

天大地大妈咪最大 提交于 2019-11-27 05:50:50
Right now I decorate a method like this to allow "members" to access my controller action [Authorize(Roles="members")] How do I allow more than one role? For example the following does not work but it shows what I am trying to do (allow "members" and "admin" access): [Authorize(Roles="members", "admin")] Jim Schmehil Another option is to use a single authorize filter as you posted but remove the inner quotations. [Authorize(Roles="members, admin")] If you want use custom roles, you can do this: CustomRoles class: public static class CustomRoles { public const string Administrator =

Non-string role names in ASP.NET MVC?

£可爱£侵袭症+ 提交于 2019-11-27 05:08:37
问题 ASP.NET MVC has good support for role-based security, but the usage of strings as role names is maddening, simply because they cannot be strongly-typed as enumerations. For example, I have an "Admin" role in my app. The "Admin" string will now exist in the Authorize attribute of my action, in my master page (for hiding a tab), in my database (for defining the roles available to each user), and any other place in my code or view files where I need to perform special logic for admin or non

Defining Roles with Rolify

萝らか妹 提交于 2019-11-27 04:39:40
问题 I am trying to make an app with Rails 4. I am looking at role management and want to use Rolify because it supports instance level role assignment. For others looking at the same problem, there are 2 really good answers below (I can only tick one but I used both). Check out lorefnon & Cyb3rDud3 answers below). I'm still figuring it out, but have made a migration with an array (as lorefnon shows) and the controller/routes functions (as Cyb3rDud3 shows). What is completely baffling me is that

Acegi Security: How do i add another GrantedAuthority to Authentication to anonymous user

被刻印的时光 ゝ 提交于 2019-11-27 03:07:04
问题 i give users special URL with access key in it. users accessing the public page via this special url should be able to see some additional data as compared to simple anonymous user. i want to give some additional role to anonymous user based on parameters provided in request so i can do something like this in my template: <@sec.authorize ifAnyGranted="ROLE_ADMIN, ROLE_USER, ROLE_INVITED_VISITOR"> ...some additional stuff for invited user to see </@sec.authorize> currently i'm implementing

Symfony2 - array to string conversion error

我的梦境 提交于 2019-11-27 01:50:05
问题 I've read the other subjects but it doesn't solve my problem so: I've got this ->add('role', 'choice', array( 'label' => 'I am:', 'mapped' => true, 'expanded' => true, 'multiple' => false, 'choices' => array( 'ROLE_NORMAL' => 'Standard', 'ROLE_VIP' => 'VIP', ) )) And whatever I do, I get this error: Notice: Array to string conversion in C:\xampp\htdocs\xxx\vendor\symfony\symfony \src\Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList.php line 458 In my form type the setRole method is

Best Role-Based Access Control (RBAC) database model [closed]

﹥>﹥吖頭↗ 提交于 2019-11-26 23:50:46
问题 What is the best database schema to track role-based access controls for a web application? I am using Rails, but the RBAC plugin linked by Google looks unmaintained (only 300 commits to SVN; latest was almost a year ago). The concept is simple enough to implement from scratch, yet complex and important enough that it's worth getting right. So how do others architect and implement their RBAC model? 回答1: To my rather basic knowledge in that area, the basic actors of an RBAC are: Resources.