View Full Version : Role based secuirty plugin

16 Apr 2011, 4:33 PM
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.

Ext.ux.secure.roles = ['my', 'user', 'roles'];

Then to have the render process an object config you do:

Ext.ux.secure.render({roles: ['role1', 'role2']});

the roles property can either be a list of roles or a single role. The render will also accept an array of config objects.

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
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:


This is an example:


ClassName should be UpperCamelCase.

Just merely a suggestion.

17 Apr 2011, 4:40 PM
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?