|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.access.MCRAccessBaseImpl
public class MCRAccessBaseImpl
This class is a base implementation of the MCRAccessInterface.
It will simply allow everything and will do nothing on persistent operations.
Feel free to extend this class if your implementation can only support parts
of the Interface definition.
| Field Summary | |
|---|---|
protected static String |
AccessPermissions
|
protected static Logger |
LOGGER
the logger |
| Constructor Summary | |
|---|---|
MCRAccessBaseImpl()
|
|
| Method Summary | |
|---|---|
void |
addRule(String permission,
Element rule,
String description)
adds an access rule for an "a priori-permission" like "create-document" |
void |
addRule(String id,
String permission,
Element rule,
String description)
adds an access rule for an ID to an access system. |
boolean |
checkPermission(Element rule)
determines whether the current user has the permission to perform a certain action. |
boolean |
checkPermission(String permission)
determines whether the current user has the permission to perform a certain action. |
boolean |
checkPermission(String permission,
MCRUser user)
determines whether a given user has the permission to perform a certain action. |
boolean |
checkPermission(String id,
String permission)
determines whether the current user has the permission to perform a certain action. |
boolean |
checkPermission(String id,
String permission,
MCRUser user)
determines whether a given user has the permission to perform a certain action. |
void |
createRule(Element rule,
String creator,
String description)
create an access rule in the rulestore using an rule string in plain text |
void |
createRule(String rule,
String creator,
String description)
create an access rule in the rulestore using an rule string in plain text |
Collection<String> |
getAccessPermissionsFromConfiguration()
just returns the String of Access Permissions configured in property "MCR.AccessPermissions" |
Collection<String> |
getAllControlledIDs()
lists all String IDs, a permission is assigned to. |
String |
getNormalizedRuleString(Element rule)
generate rule string from xml |
Collection<String> |
getPermissions()
lists all a-priori permissions like "create-document". |
Collection<String> |
getPermissionsForID(String objid)
lists all permissions defined for the id. |
Element |
getRule(String permission)
exports a access rule for a "a priori permission" as JDOM element. |
Element |
getRule(String objID,
String permission)
exports a access rule as JDOM element. |
String |
getRuleDescription(String permission)
returns the prosa description of a defined rule for a "a priori" permission like "create-document". |
String |
getRuleDescription(String id,
String permission)
returns the prosa description of a defined rule. |
boolean |
hasRule(String id)
checks wether a rule with the id is defined. |
boolean |
hasRule(String id,
String permission)
checks wether a rule with the id and permission is defined. |
static MCRAccessInterface |
instance()
The method return a singleton instance of MCRAccessInterface. |
void |
removeAllRules(String id)
removes all rules of the id. |
void |
removeRule(String permission)
removes a rule for an "a priori permission" like "create-document" |
void |
removeRule(String id,
String permission)
removes a rule. |
void |
updateRule(String permission,
Element rule,
String description)
updates an access rule for an "a priori permission" of an access system like "create-document". |
void |
updateRule(String id,
String permission,
Element rule,
String description)
updates an access rule for an ID to an access system. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String AccessPermissions
protected static Logger LOGGER
| Constructor Detail |
|---|
public MCRAccessBaseImpl()
| Method Detail |
|---|
public static MCRAccessInterface instance()
public void addRule(String id,
String permission,
Element rule,
String description)
throws MCRException
MCRAccessInterfaceid serves as an identifier for the concrete underlying
rule, e.g. a MCRObjectID.
addRule in interface MCRAccessInterfaceid - the ID-String of the objectpermission - the access permission for the rulerule - the access ruledescription - a String description of the rule in prosa
MCRException - if an error occured
public void addRule(String permission,
Element rule,
String description)
throws MCRException
MCRAccessInterface
addRule in interface MCRAccessInterfacepermission - the access permission for the rule (e.g. "create-document")rule - the access ruledescription - a String description of the rule in prosa
MCRException - if an error occured
public void removeRule(String id,
String permission)
throws MCRException
MCRAccessInterfaceid serves as an identifier
for the concrete underlying rule, e.g. a MCRObjectID.
removeRule in interface MCRAccessInterfaceid - the ID-String of the objectpermission - the access permission for the rule
MCRException - if an error occured
public void removeRule(String permission)
throws MCRException
MCRAccessInterface
removeRule in interface MCRAccessInterfacepermission - the access permission for the rule
MCRException - if an error occured
public void removeAllRules(String id)
throws MCRException
MCRAccessInterfaceid. The parameter
id serves as an identifier for the concrete underlying
rule, e.g. a MCRObjectID.
removeAllRules in interface MCRAccessInterfaceid - the ID-String of the object
MCRException - if an errow was occured
public void updateRule(String id,
String permission,
Element rule,
String description)
throws MCRException
MCRAccessInterfaceid serves as an identifier for the concrete underlying
rule, e.g. a MCRObjectID.
updateRule in interface MCRAccessInterfaceid - the ID-String of the objectpermission - the access permission for the rulerule - the access ruledescription - a String description of the rule in prosa
MCRException - if an errow was occured
public void updateRule(String permission,
Element rule,
String description)
throws MCRException
MCRAccessInterface
updateRule in interface MCRAccessInterfacepermission - the access permission for the rulerule - the access ruledescription - a String description of the rule in prosa
MCRException - if an errow was occured
public boolean checkPermission(String id,
String permission)
MCRAccessInterfaceMCRSession instance which can be retrieved by
MCRSession currentSession = MCRSessionMgr.getCurrentSession();The parameter
id serves as an identifier for the concrete
underlying rule, e.g. a MCRObjectID.
checkPermission in interface MCRAccessInterfaceid - the ID-String of the objectpermission - the permission/action to be granted, e.g. "read"
MCRSessionMgr.getCurrentSession(),
MCRSession
public boolean checkPermission(String id,
String permission,
MCRUser user)
MCRAccessInterfaceid serves as an identifier for the concrete
underlying rule, e.g. a MCRObjectID.
checkPermission in interface MCRAccessInterfaceid - the ID-String of the objectpermission - the permission/action to be granted, e.g. "read"user - the MCRUser, whose permissions are checked
MCRSessionMgr.getCurrentSession(),
MCRSessionpublic boolean checkPermission(String permission)
MCRAccessInterfaceMCRSession instance which can be retrieved by
MCRSession currentSession = MCRSessionMgr.getCurrentSession();This method is used for checking "a priori permissions" like "create-document" where a String ID does not exist yet
checkPermission in interface MCRAccessInterfacepermission - the permission/action to be granted, e.g. "create-document"
MCRSessionMgr.getCurrentSession(),
MCRSession
public boolean checkPermission(String permission,
MCRUser user)
MCRAccessInterface
checkPermission in interface MCRAccessInterfacepermission - the permission/action to be granted, e.g. "create-document"user - the MCRUser, whose permissions are checked
MCRSessionMgr.getCurrentSession(),
MCRSessionpublic boolean checkPermission(Element rule)
MCRAccessInterfaceMCRSession instance which can be retrieved by
MCRSession currentSession = MCRSessionMgr.getCurrentSession();
checkPermission in interface MCRAccessInterfacerule - the jdom-representation of a mycore access rule
MCRSessionMgr.getCurrentSession(),
MCRSession
public Element getRule(String objID,
String permission)
MCRAccessInterface
getRule in interface MCRAccessInterfaceobjID - the ID-String of the objectpermission - the access permission for the rule
null if no rule is
definedpublic Element getRule(String permission)
MCRAccessInterface
getRule in interface MCRAccessInterfacepermission - the access permission for the rule
null if no rule is
definedpublic String getRuleDescription(String permission)
MCRAccessInterface
getRuleDescription in interface MCRAccessInterfacepermission - the access permission for the rule
public String getRuleDescription(String id,
String permission)
MCRAccessInterface
getRuleDescription in interface MCRAccessInterfaceid - the ID-String of the objectpermission - the access permission for the rule
public Collection<String> getPermissionsForID(String objid)
MCRAccessInterfaceid.
The parameter id serves as an identifier for the concrete
underlying rule, e.g. a MCRObjectID.
getPermissionsForID in interface MCRAccessInterfaceList of all for id defined
permissionpublic Collection<String> getPermissions()
MCRAccessInterface
getPermissions in interface MCRAccessInterfaceList of all defined permissions
public boolean hasRule(String id,
String permission)
(getRule(id, permission)!=null);
hasRule in interface MCRAccessInterfaceid - the ID-String of the objectpermission - the access permission for the rule
getRule(String, String)public boolean hasRule(String id)
(getPermissionsForID(id).size()>0);
hasRule in interface MCRAccessInterfaceid - the ID-String of the object
getRule(String, String)public Collection<String> getAccessPermissionsFromConfiguration()
getAccessPermissionsFromConfiguration in interface MCRAccessInterfacepublic Collection<String> getAllControlledIDs()
MCRAccessInterfaceid serves as an identifier for the concrete
underlying rule, e.g. a MCRObjectID.
getAllControlledIDs in interface MCRAccessInterfaceList of all String IDs
public void createRule(String rule,
String creator,
String description)
MCRAccessInterface
createRule in interface MCRAccessInterfacerule - the rule string in plain textdescription - a String description of the rule in prosa
public void createRule(Element rule,
String creator,
String description)
MCRAccessInterface
createRule in interface MCRAccessInterfacerule - the rule string as xmldescription - a String description of the rule in prosapublic String getNormalizedRuleString(Element rule)
MCRAccessInterface
getNormalizedRuleString in interface MCRAccessInterface
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||