|
Qizx/db 2.1 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.qizx.api.util.accesscontrol.AccessControlBase
com.qizx.api.util.accesscontrol.UnixStyleAccessControl
AccessControl example: a simplified Unix-style access control.
It can hardly be used in production, because groups or roles are not supported. But this class serves mainly as an example of implementation.
Each Library Member has a special property "user-id" which is a user name, and a special property "access-rights", which is a bit mask of permissions.
| Nested Class Summary | |
static class |
UnixStyleAccessControl.User
Simple model of a Unix-style User. |
| Field Summary | |
static int |
OTHER_ALL
Read/Write access permission for the rest of the world. |
static int |
OTHER_READ
Read access permission for the rest of the world. |
static int |
OTHER_WRITE
Write access permission for the rest of the world. |
static int |
OWNER_ALL
Read/Write access permission for the User. |
static int |
OWNER_READ
Read access permission for the User. |
static int |
OWNER_WRITE
Write access permission for the User. |
| Fields inherited from class com.qizx.api.util.accesscontrol.AccessControlBase |
CONTENT_CHANGE, CONTENT_READ, DEFINED, PROPERTY_CHANGE, PROPERTY_READ |
| Constructor Summary | |
UnixStyleAccessControl()
Builds a default access control with moderate cache size. |
|
UnixStyleAccessControl(int cacheSize)
Builds an access control with specified cache size. |
|
| Method Summary | |
protected int |
computePermissions(LibraryMember member,
User user)
Specific implementation of permission computation. |
AccessControl |
copy()
Creates a new instance of the Access Control. |
boolean |
mayChangeContent(User user,
LibraryMember member)
Checks if a User has the permission to modify the contents of a Library Object. |
boolean |
mayChangeProperty(User user,
LibraryMember member,
String propertyName)
Checks if a User has the permission to modify the value of a property of a Library member. |
boolean |
mayReadContent(User user,
LibraryMember member)
Checks if a User has the permission to get the contents of a Library member. |
boolean |
mayReadProperty(User user,
LibraryMember member,
String propertyName)
Checks if a User has the permission to get the value of a property of a Library member. |
| Methods inherited from class com.qizx.api.util.accesscontrol.AccessControlBase |
cachePermissions, clearPermissions, findPermissions, getCachedPermissions, getCacheSize, reset |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int OWNER_READ
public static final int OWNER_WRITE
public static final int OWNER_ALL
public static final int OTHER_READ
public static final int OTHER_WRITE
public static final int OTHER_ALL
| Constructor Detail |
public UnixStyleAccessControl()
public UnixStyleAccessControl(int cacheSize)
| Method Detail |
public boolean mayReadContent(User user,
LibraryMember member)
AccessControl
user - an implementation of a User, suitable for this AccessControlmember - Library object to check for permission
public boolean mayChangeContent(User user,
LibraryMember member)
AccessControl
user - an implementation of a User, suitable for this AccessControlmember - Library object to check for permission
public boolean mayReadProperty(User user,
LibraryMember member,
String propertyName)
AccessControl
user - an implementation of a User, suitable for this AccessControlmember - Library Object to check for permissionpropertyName - name of the property to get. Attention: it may be
null, meaning 'any property' (for example when controlling for
the method getPropertyNames() of LibraryMember).
public boolean mayChangeProperty(User user,
LibraryMember member,
String propertyName)
AccessControl
user - an implementation of a User, suitable for this AccessControlmember - Library Object to check for permissionpropertyName - name of the property to set. Never null
protected int computePermissions(LibraryMember member,
User user)
throws DataModelException
Distinguishes between Owner and Other-User (no groups or roles).
Also sets permissions for new Library members by using the default permission mask associated with a user.
computePermissions in class AccessControlBasemember - concerned object of the Libraryuser - user concerned by the access control
DataModelException - if access problemAccessControlBase.computePermissions(com.qizx.api.LibraryMember, com.qizx.api.User)public AccessControl copy()
AccessControlThis method is used when a new session is created. Typically it would initialize the new instance with settings copied from the master AccessControl specified on the LibraryManager.
|
© 2008 Axyana Software | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||