roles

Restrict Area to a given role

旧城冷巷雨未停 提交于 2019-12-05 16:43:12
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? You could define a base controller decorated with this attribute that all controllers in the area derive from. 来源: https://stackoverflow.com/questions/3291385/restrict-area-to-a-given-role

Symfony 2 ACL and Role Hierarchy

微笑、不失礼 提交于 2019-12-05 16:39:38
I'm a little stuck and unable to find the answer to this. In my app test I've created two Entities User and Comment both are mapped correctly. I have created a small controller which depending on the user will add the comment and the data to the ACL tables, if I create my comment as a standard user with the associated for of 'ROLE_USER', and Try to access it as user with the role 'ROLE_ADMIN' I get access denied, it seems to completely ignore the security.yml hierarchy. I know this works by adding instead of the userid the ROLE_USER etc but I don't want to do it this way. Examples of my code

Two owners of the same PostgreSQL database

允我心安 提交于 2019-12-05 16:31:25
问题 Is it possible with Postgresql to create a database which has 2 users which act like owners to the database? I can create a group role and add both users to that group, and then make the group the owner of the database, but this requires both users to be have to manually set their role on every connection to make any tables they have created accessible to the other user. Is there any way to make the group be the default role for a user each time they log in or any other way to achieve the

Ansible - with_dict: dictionary - How to use variables defined in each dictionary which depends upon others

。_饼干妹妹 提交于 2019-12-05 10:29:39
Environment is: Ansible 1.9.2, CentOS 6.5 I have created a role to download JAVA (.tar.gz) artifact files for 3 different JAVA versions from Artifactory. I'm trying to use Ansible's with_dict feature (instead of using with_items). Created the following files: $ cat roles/java/defaults/main.yml --- java_versions: java7_60: version: 1.7.60 group_path: com/oracle/jdk classifier: linux-x64 ext: tar.gz dist_file: "jdk-{{ version }}-{{ classifier }}-{{ ext }}" # dist_file: "jdk-{{item.value.version }}-{{ item.value.classifier }}-{{ item.value.ext }}" dist_url: "{{ artifactory_url }}/{{ group_path }}

Woocommerce: changing user role when order is complete

旧巷老猫 提交于 2019-12-05 08:02:09
问题 I'm using wordpress with woocommerce, and I would like to automate the following step. When an order is completed, I would like to change the user role associated with that order id from 'customer' to 'subscriber'. By searching around, I think I should be able to accomplish this by using a hook in functions.php: add_action( 'woocommerce_order_status_completed', 'change_role_from_customer_to_subscriber' ); Then add the function: function change_role_from_customer_to_subscriber($order_id){ //

Dynamic generation of RBAC roles and permissions

。_饼干妹妹 提交于 2019-12-05 07:12:37
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, and a different role on another project; the permissions granted to a role are consistent for every

ASP.net is user in role

落花浮王杯 提交于 2019-12-05 06:12:48
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? 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); There is a better way just with if (Roles.IsUserInRole("Admin")) { // Code Here... } 来源: https:/

REST, caching, and authorizing with multiple user roles

自闭症网瘾萝莉.ら 提交于 2019-12-05 03:55:40
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 different response than user B; user A may even receive a different response as he switches to a different

Pass Ansible variables from one role (running on one host) to another role running on another host within the same playbook

孤人 提交于 2019-12-05 03:13:10
I have a playbook that runs different roles on different hosts. Is it possible to pass a variable from one role running on one host to another role on another host running within the same playbook run? Or any workaround ? playbook host1 role1 here I get some variables: var1 var2 ...etc host2 role2 here I need to use var1 var2 ... etc from the above host/role The task in role1 that sets teh variable db looks like this: - shell: cd /ACE/conf && grep ^db.url local1.properties | awk -F/ '{print $4}' | awk -F? '{print $1}' register: db UPDATE: On the first host the values are dynamic, it's like a

Best approach to user roles with an intranet application

て烟熏妆下的殇ゞ 提交于 2019-12-05 01:43:10
问题 I'm developing an ASP.NET MVC intranet website which needs to have a few different user roles (admin, editor, writer, etc.) and the backend uses SQL Server. I read this post by scottgu about role-based security and used that as a starting point. The steps I followed were: Configured a DB using the asp_regsql.exe application Set the authentication mode to windows <authentication mode = "Window" /> Added a connection string entry to the Web.config, <connectionStrings> <add name=