Flex-Security access control framework

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

From: http://code.google.com/p/flex-security/


The flex UI component access control framework

A fast start.

1) Download and add flex_security.swf to your Flex LIBS

2) Start the access control

//Start the access control list permissions for the user, the string permissions owned
SecurityControler.start(permissions,'visible');

3) The increase of styleName=security (permission, controlBy) increased access control for your button

<mx:Button label="new user" styleName="security(user_new)" />
<mx:Button label="update user" styleName="security(user_update)"/>

As above, if the user has the two authority (permissions): user_new, user_update, you can see the two button, and then perform the operation

Two.ActionScript code access control

if(SecurityControler.isPermitted('blog_delete')) 
{
    //execute delete blog action
}

Three line demo.

A detailed description of four.

styleName: security(permission,controlBy)

controlBy

By what means to control authority.

The SecurityControler class contains all the control authority, the main operation:

/**
 * Start the access control
 * The permissions: string list, as the permissions
 * The default_control_by: control way, optionalvalue: visible,enabled,remove,includeInLayout
 */
public static function start(permissions:ArrayCollection = null,default_control_by : String = "visible"):void 

//Stop access control 
public static function stop():void 

// Remove all permissions
public static function removeAllPerms():void
/**
 * Update permissions
 * The perms: string list, the user has permissions
 */             
public static function updatePerms(perms:ArrayCollection):void 

//Add a permission        
public static function addPerm(permName:String):void

// Cut a permission
public static function removePerm(permName:String):void

// To determine whether the permissions
//Example: if(SecurityControler.isPermitted('blog_delete')) { do some thing} 
public static function isPermitted(perm:String):boolean
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Theodore at December 14, 2013 - 2:13 PM