roles

access control, role and permission in grails

三世轮回 提交于 2020-01-01 06:42:12
问题 I am working on a grails application for the first time and I now want to protect some pages to be viewed only by admins, and give some permissions to other users. I am using Apache Shiro plugin for grails. My sample code in the bootstrap looks like this class BootStrap { def init = { servletContext -> def adminRole if(ShiroRole.findByName("Admin".isEmpty())){ adminRole = new ShiroRole(name: "Administrator") adminRole.addToPermissions("*:*") adminRole.addToPermissions("admin") adminRole.save(

Wordpress add custom roles as well as remove default roles

柔情痞子 提交于 2020-01-01 04:50:53
问题 I need to customize the default roles as I need only 3 roles - administrator, buyer, seller . Then I need to add the buyer, seller and remove all other default roles. What should I do? If there is any ready made code which I can paste in and it will work? 回答1: Paste this code in your themes function.php file and customize as your need. This is from my own code library. So it will definitely work. /* Add member role to the site */ add_role('member', 'Member', array( 'read' => true, 'edit_posts

ASP.NET Membership - Which RoleProvider to use so User.IsInRole() checks ActiveDirectory Groups?

杀马特。学长 韩版系。学妹 提交于 2019-12-31 22:22:42
问题 Very simple question actually: I currently have IIS anonymous access disabled, users are automatically logged on using their Windows login. However calling User.IsInRole("Role name") returns false. I double-checked User.Identity.Name() and the "Role name" and it should return true. I currently have this in my Web.Config: UPDATE I was calling User.IsInRole("Role name") where I should call User.IsInRole("DOMAIN\Role name") However I still like to know if the <membership> entry is needed at all?

Change from Roles authorization to Claims authorization

允我心安 提交于 2019-12-31 05:06:59
问题 I have a webforms application which was built with ASP.NET Membership. I migrated to Identities successfully. I now want to use Claims authorization instead of Roles authorization, but the Role information for the old users has been migrated to the AspNetUserRoles table in the database but the AspNetUserClaims table is empty. New users registered after migration, I can add to AspNetUserClaims with the following code: IdentityResult result1 = manager.AddClaim(user.Id, new Claim(ClaimTypes.Role

Sitecore Role Security Make Access Overriding Deny

微笑、不失礼 提交于 2019-12-30 10:38:22
问题 I have user roles that work as follows: Admin is a role in Manger which is a role in Logged in User. I want this to work this way so that if a user has an Admin role, then they will also have a Logged in User role. This reason for this is checks in the code. I don't really want to have to write something that incrementally checks each role to see if a user has access to something when I can just check if they are a Logged in User. Now I want to be able to apply security to sitecore items. The

how to enable and disable button based on user role?

本小妞迷上赌 提交于 2019-12-30 09:58:09
问题 I have a role called 'member' and another 'admin' in Asp.Net website. I did before, that button should be visible or not and i am successful in that,but,i am not able to get the proper code(aspx.cs) to disable the button so that it may be in view but not at all accessible. <asp:Button ID="Button4" runat="server" PostBackUrl="~/report.aspx" Text="print in report format" Width="173px" Enabled='<%# HttpContext.Current.User.IsInRole("Admin") %>' /> i want that whenever a member login then button

How do you access the roles of the currentItem from a listview in QML?

断了今生、忘了曾经 提交于 2019-12-30 01:55:08
问题 I'm trying to access a role from a ListView in QML. Essentially, I have this in my QML: ListView { id: myId model: myModel delegate: Item { Text { text: model.text } Text { text: model.moreText } } } myModel is a QAbstractListModel implementation. The QML portion of this is a reusable component, so the model could have any number of different roles with various data types. What I would like to do is bind to the value of a given role of the currentItem property of the ListView. In other words,

Mvc Runtime error - The Role Manager feature has not been enabled

时光毁灭记忆、已成空白 提交于 2019-12-29 07:46:06
问题 I am trying to implement basic role management manually. When a user logs in if they are admin or not they are added to a role I am getting this error: Exception Details: System.Configuration.Provider.ProviderException: The Role Manager feature has not been enabled. This is the method that causes the error: public void addUserToRole(String user, String role) { if (!Roles.RoleExists(role)) Roles.CreateRole(role); Roles.AddUserToRole(user, role); } here is my web.config <profile defaultProvider

Rails 4 - Rolify — setting scoped roles

强颜欢笑 提交于 2019-12-25 18:06:37
问题 I am trying to setup roles on my app. I have models called user, profile, organisation and roles. The associations are: User class User < ActiveRecord::Base rolify strict: true attr_accessor :current_role Profile belongs_to :user belongs_to :organisation Organisation belongs_to :owner, class_name: 'User' has_many :profiles resourcify Roles class Role < ActiveRecord::Base scopify has_and_belongs_to_many :users, join_table: "users_roles" belongs_to :resource, :polymorphic => true validates

Rails 4 - Rolify — setting scoped roles

本小妞迷上赌 提交于 2019-12-25 18:03:03
问题 I am trying to setup roles on my app. I have models called user, profile, organisation and roles. The associations are: User class User < ActiveRecord::Base rolify strict: true attr_accessor :current_role Profile belongs_to :user belongs_to :organisation Organisation belongs_to :owner, class_name: 'User' has_many :profiles resourcify Roles class Role < ActiveRecord::Base scopify has_and_belongs_to_many :users, join_table: "users_roles" belongs_to :resource, :polymorphic => true validates