org.objectweb.jac.aspects.user
Interface UserConf

All Known Implementing Classes:
UserAC

public interface UserConf


Method Summary
 void addAddable(String profile, String resourceExpr)
          Adds an addable resources set to a profile (collection dedicated).
 void addCreatable(String profile, String resourceExpr)
          Adds a creatable resources set to a profile (collection dedicated).
 void addFilter(CollectionItem collection, MethodItem filter)
          For the specified collection, apply a filter on its getter, so that some items can be hidden depending on the user.
 void addOwnerFilter(String profile, ClassItem cl, String collectionName)
          For the specified collection, users will only see the objects that they own.
 void addReadable(String profile, String resourceExpr)
          Adds a readable resources set to a profile.
 void addRemovable(String profile, String resourceExpr)
          Adds an removable resources set to a profile (collection dedicated).
 void addWritable(String profile, String resourceExpr)
          Adds a writable resources set to a profile.
 void autoInitClasses(String classExpr)
          This method should affect all the classes that define a reference towards a user of the application and that should be seamlessly initialized to the currently logged user (instead of been filled in interactively).
 void clearProfile(String name)
          Use this config method to clear a profile so that it can be reinitialized from the config file.
 void declareProfile(String profile)
          Declares a new profile (that has no parent).
 void declareProfile(String profile, String parent)
          Declares a new profile that inherits from the caracteristics of its parent.
 void defineAdministrator(String login, String password)
          Create an administrator user.
 void defineHabilitation(ClassItem cli, MethodItem condition)
          Defines a contextual habilitation test for instances of given class (This is a generic method to be used when the habilitation does not fit any simple scheme).
 void defineHabilitation(MethodItem condition)
          Defines a contextual habilitation test (this is a generic method to be used when the habilitation does not fit any simple scheme).
 void setContextualProfile(ClassItem cl, String field, String profile)
          Set a contextual profile to a reference or a collection that contains user(s).
 void setUserClass(ClassItem userClass, String loginField, String passwordField, String profileField)
          Sets the class of the application that must be used as a storage for the users.
 

Method Detail

setUserClass

public void setUserClass(ClassItem userClass,
                         String loginField,
                         String passwordField,
                         String profileField)
Sets the class of the application that must be used as a storage for the users.

The users are eventually used to know what user is currently logged into the system so you should define fields that can be used to identify the user.

Parameters:
userClass - the class that represents the application's users
loginField - the field that stores the login (iow the user's id)
passwordField - the field that stores the password (not mandatory it no password authentication is performed)
profileField - the field that contains the profile (if any, can be null)
See Also:
UserPasswordAuthenticator

autoInitClasses

public void autoInitClasses(String classExpr)
This method should affect all the classes that define a reference towards a user of the application and that should be seamlessly initialized to the currently logged user (instead of been filled in interactively).

Parameters:
classExpr - a class pointcut expression that denote all the classes that should be affected by this behavior

declareProfile

public void declareProfile(String profile)
Declares a new profile (that has no parent).

A profile is a kind of user type that has some well-defined persmissions to access or to modify elements of the configured application (e.g. the default user.acc defines an administrator profile that grants access and modification of all the elements).

Parameters:
profile - the profile's name
See Also:
declareProfile(String,String)

clearProfile

public void clearProfile(String name)
Use this config method to clear a profile so that it can be reinitialized from the config file.

Parameters:
name - name of the profile to clear

declareProfile

public void declareProfile(String profile,
                           String parent)
Declares a new profile that inherits from the caracteristics of its parent.

All the parent access permissions can be restrained (and only restrained) by the child profile (a permission that is not granted by the parent cannot be granted by the child).

Parameters:
profile - the profile's name
parent - the parent profile's name
See Also:
declareProfile(String)

addReadable

public void addReadable(String profile,
                        String resourceExpr)
Adds a readable resources set to a profile.

Parameters:
profile - the profile's name
resourceExpr - a regular expression that denotes a set of resources (based on package.class.member)

addWritable

public void addWritable(String profile,
                        String resourceExpr)
Adds a writable resources set to a profile.

Parameters:
profile - the profile's name
resourceExpr - a regular expression that denotes a set of resources (based on package.class.member)

addRemovable

public void addRemovable(String profile,
                         String resourceExpr)
Adds an removable resources set to a profile (collection dedicated).

Parameters:
profile - the profile's name
resourceExpr - a regular expression that denotes a set of resources (based on package.class.member)

addAddable

public void addAddable(String profile,
                       String resourceExpr)
Adds an addable resources set to a profile (collection dedicated).

Parameters:
profile - the profile's name
resourceExpr - a regular expression that denotes a set of resources (based on package.class.member)

addCreatable

public void addCreatable(String profile,
                         String resourceExpr)
Adds a creatable resources set to a profile (collection dedicated).

Parameters:
profile - the profile's name
resourceExpr - a regular expression that denotes a set of resources (based on package.class)

defineAdministrator

public void defineAdministrator(String login,
                                String password)
Create an administrator user.

A user class must have been defined with setUserClass(). The administrator user will be created only if no user with the given login already exist. If created, the administrator user will be given the "administrator" profile.

Parameters:
login - the login name of the administrator
password - the password of the administrator
See Also:
setUserClass(ClassItem,String,String,String)

defineHabilitation

public void defineHabilitation(MethodItem condition)
Defines a contextual habilitation test (this is a generic method to be used when the habilitation does not fit any simple scheme).

Parameters:
condition - the contextual condition (a static method that takes the substance, the currently tested item, the action's type and that returns true if the habilitation is granted)
See Also:
defineHabilitation(ClassItem,MethodItem)

defineHabilitation

public void defineHabilitation(ClassItem cli,
                               MethodItem condition)
Defines a contextual habilitation test for instances of given class (This is a generic method to be used when the habilitation does not fit any simple scheme).

Parameters:
cli - the class the test applies to
condition - the contextual condition (a static method that takes the substance, the currently tested item, the action's type (one of GuiAC.VISIBLE, GuiAC.EDITABLE, GuiAC.ADDABLE or GuiAC.REMOVABLE) and that returns true if the habilitation is granted)
See Also:
defineHabilitation(MethodItem)

addOwnerFilter

public void addOwnerFilter(String profile,
                           ClassItem cl,
                           String collectionName)
For the specified collection, users will only see the objects that they own.

Parameters:
profile - apply the filter only if the user has this profile
cl - the class holding the collection
collectionName - name of the collection attribute

addFilter

public void addFilter(CollectionItem collection,
                      MethodItem filter)
For the specified collection, apply a filter on its getter, so that some items can be hidden depending on the user.

Parameters:
collection - the collection to filter
filter - a static method which takes a Collection (the one to filter), an Object (the holder of the collection), a CollectionItem, and a User and returns the filtered collection.

setContextualProfile

public void setContextualProfile(ClassItem cl,
                                 String field,
                                 String profile)
Set a contextual profile to a reference or a collection that contains user(s).

If one user is added to the given field at runtime, the user will then have the given profile for the current object.

Parameters:
cl - the class that owns the field
field - the profiled field
profile - the profile to be set contextually