Packageorg.springextensions.actionscript.security
SVN browsingSimpleSecurityManagerFactory.as
FisheyeSimpleSecurityManagerFactory.as
Classpublic class SimpleSecurityManagerFactory
ImplementsISecurityManagerFactory

ISecurityManagerFactory that holds the roles and rights data for a specified list of UIComponents in a dictionary with a UIComponent id as its key and an IMembershipOwner as its value.

When a UIComponent is passed to its createInstance() the component's id is looked up in this dictionary, and if a valid IMembershipOwner is found an ISecurityManager is created for the UIComponent and added to the managersList.



Documentation reference: the simplesecuritystageprocessor class

Sample project: security (source)


Public Properties
 PropertyDefined by
  managersList : Array
[read-only] An Array of ISecurityManagers that have been created by the current SimpleSecurityManagerFactory
SimpleSecurityManagerFactory
  membershipData : Dictionary
A Dictionary containing membershipData, the key should be the id of an UIComponent on the stage, the value is MembershipAccessData instance whose roles and rights arrays and AcccessStrategy will be assigned to the ISecurityManager that is created for the stage component.
SimpleSecurityManagerFactory
  membershipOwner : IMembershipOwner

IMembershipOwner instance that will be monitored and whose changes will be used to let the ISecurityManagers evaluate access to the objects they manage.

Typically an ISecurityManagerFactory will call the checkMembership() method on each ISecurityManager it created when this property changes.

SimpleSecurityManagerFactory
Protected Properties
 PropertyDefined by
  componentCache : Dictionary
A Dictionary instance used to keep track of the stage components that have already been processed by the current SimpleSecurityManagerFactory.
SimpleSecurityManagerFactory
Public Methods
 MethodDefined by
  
Creates a new SimpleSecurityManagerFactory instance.
SimpleSecurityManagerFactory
  
Creates a new ISecurityManager for the specified object when possible, returns the newly created instance or null.
SimpleSecurityManagerFactory
  
hasAccess(objectId:String):Boolean
SimpleSecurityManagerFactory
Protected Methods
 MethodDefined by
  
Adds event listeners for the rolesChanged and rightsChanged events on the membershipOwner when its not null.
SimpleSecurityManagerFactory
  
createSecurityManager(component:UIComponent):ISecurityManager
If an IMembershipOwner exists in the membershipData Dictionary for the id of the specified UIComponent a new ISecurityManager instance is created for the specified UIComponent using the IMembershipOwner instance.
SimpleSecurityManagerFactory
  
membershipOwnerChange_handler(event:Event = null):void
Calls the checkMembership() method on all the ISecurityManager instances that the current SimpleSecurityManager has created.
SimpleSecurityManagerFactory
  
Removes event listeners for the rolesChanged and rightsChanged events from the membershipOwner when its not null.
SimpleSecurityManagerFactory
Property detail
componentCacheproperty
protected var componentCache:Dictionary

A Dictionary instance used to keep track of the stage components that have already been processed by the current SimpleSecurityManagerFactory. This Dictionary instance is created with the weakKeys constructor argument set to true and will therefore not cause any memory leaks should any of the stage components be removed from the permanently.

managersListproperty 
managersList:Array  [read-only]

An Array of ISecurityManagers that have been created by the current SimpleSecurityManagerFactory

Implementation
    public function get managersList():Array
membershipDataproperty 
membershipData:Dictionary  [read-write]

A Dictionary containing membershipData, the key should be the id of an UIComponent on the stage, the value is MembershipAccessData instance whose roles and rights arrays and AcccessStrategy will be assigned to the ISecurityManager that is created for the stage component.

Implementation
    public function get membershipData():Dictionary
    public function set membershipData(value:Dictionary):void
membershipOwnerproperty 
membershipOwner:IMembershipOwner  [read-write]

IMembershipOwner instance that will be monitored and whose changes will be used to let the ISecurityManagers evaluate access to the objects they manage.

Typically an ISecurityManagerFactory will call the checkMembership() method on each ISecurityManager it created when this property changes.

Implementation
    public function get membershipOwner():IMembershipOwner
    public function set membershipOwner(value:IMembershipOwner):void
Constructor detail
SimpleSecurityManagerFactory()constructor
public function SimpleSecurityManagerFactory()

Creates a new SimpleSecurityManagerFactory instance.

Method detail
bindMembershipOwner()method
protected function bindMembershipOwner():void

Adds event listeners for the rolesChanged and rightsChanged events on the membershipOwner when its not null.

createInstance()method 
public function createInstance(object:Object):ISecurityManager

Creates a new ISecurityManager for the specified object when possible, returns the newly created instance or null.

Parameters
object:Object — The specified object for which an ISecurityManager might be created.

Returns
ISecurityManager — A new ISecurityManager instance or null.
createSecurityManager()method 
protected function createSecurityManager(component:UIComponent):ISecurityManager

If an IMembershipOwner exists in the membershipData Dictionary for the id of the specified UIComponent a new ISecurityManager instance is created for the specified UIComponent using the IMembershipOwner instance.

Parameters
component:UIComponent — The specified UIComponent

Returns
ISecurityManager — A new ISecurityManager instance or null if a valid IMembershipOwner wasn't found
hasAccess()method 
public function hasAccess(objectId:String):BooleanParameters
objectId:String

Returns
Boolean
membershipOwnerChange_handler()method 
protected function membershipOwnerChange_handler(event:Event = null):void

Calls the checkMembership() method on all the ISecurityManager instances that the current SimpleSecurityManager has created.

Parameters
event:Event (default = null)

See also

unbindMembershipOwner()method 
protected function unbindMembershipOwner():void

Removes event listeners for the rolesChanged and rightsChanged events from the membershipOwner when its not null.