roles

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

天涯浪子 提交于 2019-11-28 09:31:11
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 Spring's OncePerRequestfilter : protected void doFilterInternal(HttpServletRequest request,

Spring Security Role Prefix and Custom User Details Service

一笑奈何 提交于 2019-11-28 08:56:50
问题 How do I set the role prefix to "" with a custom user details service in Spring? <beans:bean id="authService" class="com.cisco.badges.business.services.AuthenticationService"/> <authentication-manager> <authentication-provider user-service-ref="authService"> <password-encoder ref="passwordEncoder"> <salt-source ref="saltSource" /> </password-encoder> </authentication-provider> </authentication-manager> @Service("authService") public class AuthenticationService extends BaseService implements

Symfony2 - array to string conversion error

给你一囗甜甜゛ 提交于 2019-11-28 07:31:53
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 not even called (when I rename it to some garbage the error still occurs). Why is this happening? //

Non-string role names in ASP.NET MVC?

空扰寡人 提交于 2019-11-28 03:29:28
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-admin users. Is there a better solution, short of writing my own authorization attribute and filter, that

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

风流意气都作罢 提交于 2019-11-28 02:51:01
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? To my rather basic knowledge in that area, the basic actors of an RBAC are: Resources. Permissions. Users. Roles (i.e. Groups). Resources <- require -> ( one or many ) Permissions . Roles <- are

Defining Roles with Rolify

拈花ヽ惹草 提交于 2019-11-27 23:13:47
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 all the documents for the Rolify gem use the console to define roles. How do I define roles in my code?

How do I serve up an Unauthorized page when a user is not in the Authorized Roles?

一笑奈何 提交于 2019-11-27 17:49:54
I am using the Authorize attribute like this: [Authorize (Roles="Admin, User")] Public ActionResult Index(int id) { // blah } When a user is not in the specified roles, I get an error page (resource not found). So I put the HandleError attribute in also. [Authorize (Roles="Admin, User"), HandleError] Public ActionResult Index(int id) { // blah } Now it goes to the Login page, if the user is not in the specified roles. How do I get it to go to an Unauthorized page instead of the login page, when a user does not meet one of the required roles? And if a different error occurs, how do I

How can I create a view that has different displays according to the role the user is in?

橙三吉。 提交于 2019-11-27 17:28:19
I want to create a view that has different displays according to the role the user is in. Should I create a different view for different roles or should I check the roles on the Veiw page itself rather than in the actions? How would I check the role on the view page? Or should i use check the roles on the Veiw page its self rather than on actions, if so can someone plz show me how do check that on view page You need to do both. Check roles on actions as a security measure and check roles on views to enable/disable specific controls. Within your view page the long form of checking a role is

Role Based Navigation

感情迁移 提交于 2019-11-27 14:08:19
问题 I've been trying to come up with a way to create a dynamic role based navigation solution for a project that I am working on. The navigation should display only links that are relative to the users role, for example: an administrator will have links to view application statistics, manage customer accounts, ect... while a standard user would have links to manage their account, communicate with friends, ect.. I currently have a single partial view called Navigation with some basic conditional

When are user roles refreshed and how to force it?

谁都会走 提交于 2019-11-27 12:17:00
问题 First off, I'm not using FOSUserBundle and I can't because I'm porting a legacy system which has its own Model layer (no Doctrine/Mongo/whatsoever here) and other very custom behavior. I'm trying to connect my legacy role system with Symfony's so I can use native symfony security in controllers and views. My first attempt was to load and return all of the user's roles in the getRoles() method from the Symfony\Component\Security\Core\User\UserInterface . At first, it looked like that worked.