Class AccessControlForSingleFile
java.lang.Object
edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile
- All Implemented Interfaces:
edu.ucsb.nceas.utilities.access.AccessControlInterface
public class AccessControlForSingleFile
extends Object
implements edu.ucsb.nceas.utilities.access.AccessControlInterface
A Class that loads eml-access.xml file containing ACL for a metadata
document into relational DB. It extends DefaultHandler class to handle
SAX parsing events when processing the XML stream.
-
Field Summary
Fields inherited from interface edu.ucsb.nceas.utilities.access.AccessControlInterface
ACCESS, ACLID, ALL, ALLOW, ALLOWFIRST, ALLSTRING, CHMOD, CHMODSTRING, DENY, DENYFIRST, ORDER, PERMISSION, PRINCIPAL, PUBLIC, READ, READSTRING, WRITE, WRITESTRING
-
Constructor Summary
ConstructorDescriptionAccessControlForSingleFile
(String accessionNumber) Construct an instance of the AccessControlForSingleFile class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
accessControlExists
(edu.ucsb.nceas.utilities.access.XMLAccessDAO xmlAccessDAO) Check if access control comination for docid/principal/permission/permorder/permtype already exists.Get the access xml for all access on this docidgetAccessString
(Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessDAOList) Put together an xml representation of the objects in a given access dao listGet Access Control List information for document from db connetion.void
insertPermissions
(edu.ucsb.nceas.utilities.access.XMLAccessDAO xmlAccessDAO) Insert a single access record into the database based on access DAO objectvoid
insertPermissions
(String accessBlock) Replace existing permissions with a given block of permissions for this document.void
insertPermissions
(String principalName, Long permission, String permType, String permOrder, String accessFileId, String subTreeId) Insert a single access record into the database.
-
Constructor Details
-
AccessControlForSingleFile
Construct an instance of the AccessControlForSingleFile class. This instance will represent one file only.- Parameters:
myAccessNumber
- the docid or docid with dev will be controlled- Throws:
AccessControlException
-
-
Method Details
-
insertPermissions
public void insertPermissions(edu.ucsb.nceas.utilities.access.XMLAccessDAO xmlAccessDAO) throws AccessControlException, PermOrderException Insert a single access record into the database based on access DAO object- Parameters:
xmlAccessDAO
- dao object holding info to insert- Throws:
AccessControlException
PermOrderException
-
insertPermissions
public void insertPermissions(String principalName, Long permission, String permType, String permOrder, String accessFileId, String subTreeId) throws AccessControlException, PermOrderException Insert a single access record into the database.- Parameters:
principalName
- the principal credentialspermission
- the permissionpermType
- the permission typepermOrder
- the permission order- Throws:
AccessControlException
PermOrderException
-
insertPermissions
Replace existing permissions with a given block of permissions for this document.- Parameters:
accessBlock
- the xml access block. This is the same structure as that returned by the getdocumentinfo action in metacat.- Throws:
AccessControlException
-
accessControlExists
public boolean accessControlExists(edu.ucsb.nceas.utilities.access.XMLAccessDAO xmlAccessDAO) throws AccessControlException Check if access control comination for docid/principal/permission/permorder/permtype already exists.- Parameters:
xmlAccessDAO
- the dao object holding the access we want to check for.- Returns:
- true if the Access Control for this file already exists in the DB
- Throws:
AccessControlException
-
getACL
Get Access Control List information for document from db connetion. User or Group should have permissions for reading access control information for a document specified by- Parameters:
user
- name of user connected to Metacat systemgroups
- names of user's groups to which user belongs- Throws:
AccessControlException
-
getAccessString
Get the access xml for all access on this docid- Returns:
- string representation of access
- Throws:
AccessControlException
-
getAccessString
public String getAccessString(Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessDAOList) throws AccessControlException Put together an xml representation of the objects in a given access dao list- Parameters:
xmlAccessDAOList
- list of xml access DAO objects- Returns:
- string representation of access
- Throws:
AccessControlException
-