-
16 Apr 2011 4:33 PM #1
Role based secuirty plugin
Role based secuirty plugin
I created a role based security plugin that renders the components based on the users roles.
It works by looking for a roles property in the configuration object and it will also look at the items for the config object and remove the configuration for the component if the users doesn't have the current permissions.
You have to initialize the object with what roles the users has.
Then to have the render process an object config you do:Code:Ext.ux.secure.roles = ['my', 'user', 'roles'];
the roles property can either be a list of roles or a single role. The render will also accept an array of config objects.Code:Ext.ux.secure.render({roles: ['role1', 'role2']});
The unit test contain a lot of examples on how the render works.
Here is the github project page: https://github.com/mrh0057/Ext-Secure-Component
-
17 Apr 2011 2:26 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
Nice idea. I haven't looked at your code but I have a quick suggestion. When you name a project, you should call it by the class name. And class names should have a descriptive naming convention. Since I develop for both ExtJS and Sencha Touch this is what I do:
Ext.[ux/plugin].[extjs/st].ClassName
This is an example:
Ext.plugin.extjs.Security
ClassName should be UpperCamelCase.
Just merely a suggestion.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
17 Apr 2011 4:40 PM #3
Ext.ux.secure is the instance of the class that handles the security. The name of the class is Ext.ux.SecurityRenderController. The code should work withe sencha touch as well as extjs 3.x and 4.x.
What should I name it since it works in both sench touch and extjs?
Similar Threads
-
What is the role of JSBuilder2 and how to use it ?
By dm520 in forum Sencha CmdReplies: 35Last Post: 5 Dec 2012, 6:57 AM -
A sencha-touch based theme plugin for WordPress: first working alpha
By sandro.paganotti in forum Sencha Touch 1.x: Examples and ShowcasesReplies: 4Last Post: 4 Sep 2010, 6:15 AM -
Role-based security and widget visualization
By KaiWeing in forum Ext GWT: DiscussionReplies: 2Last Post: 2 Jul 2010, 7:03 AM -
ExtJS and role based UI
By Whatty in forum Community DiscussionReplies: 8Last Post: 21 Nov 2009, 5:00 AM -
How to dynamically make grid columns editable based on user role?
By wgpubs in forum Ext 2.x: Help & DiscussionReplies: 3Last Post: 4 Dec 2008, 8:33 AM


Reply With Quote