Class XMLAccessAccess
java.lang.Object
edu.ucsb.nceas.metacat.shared.BaseAccess
edu.ucsb.nceas.metacat.accesscontrol.XMLAccessAccess
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addXMLAccess
(String guid, String principalName, Long permission, String permType, String permOrder, String accessFileId, String subTreeId) Add permissions for a given principal on a given document.void
deleteXMLAccessForDoc
(String guid) Delete xml access.void
deleteXMLAccessForDoc
(String guid, String permType, DBConnection conn) Delete xml access.Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO>
getXMLAccessForDoc
(String guid) Get all xml access for a documentVector<edu.ucsb.nceas.utilities.access.XMLAccessDAO>
getXMLAccessForPrincipal
(String guid, String principalName) Get all xml access for a principal for a certain documentVector<edu.ucsb.nceas.utilities.access.XMLAccessDAO>
getXMLAccessForPrincipal
(String guid, String principalName, String permType, String permOrder) Get all xml access for a principal/permType/permOrder for a certain documentvoid
insertAccess
(String guid, List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList) Set permissions for a given document.void
insertAccess
(String guid, List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList, DBConnection conn) Set permissions for a given document.protected edu.ucsb.nceas.utilities.access.XMLAccessDAO
populateDAO
(ResultSet resultSet) Populate a job data object with the current row in a resultsetvoid
removeXMLAccessForPrincipal
(String guid, String principalName, Long permission) Remove xml access.void
replaceAccess
(String guid, List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList) Set permissions for a given document.Methods inherited from class edu.ucsb.nceas.metacat.shared.BaseAccess
closeDBObjects
-
Constructor Details
-
XMLAccessAccess
- Throws:
AccessException
-
-
Method Details
-
getXMLAccessForDoc
public Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> getXMLAccessForDoc(String guid) throws AccessException Get all xml access for a document- Parameters:
guid
- the id of the document- Returns:
- an xml access DAO list
- Throws:
AccessException
-
getXMLAccessForPrincipal
public Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> getXMLAccessForPrincipal(String guid, String principalName) throws AccessException Get all xml access for a principal for a certain document- Parameters:
guid
- the id of the documentprincipalName
- the credentials of the principal in the database- Returns:
- an xml access DAO list
- Throws:
AccessException
-
getXMLAccessForPrincipal
public Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> getXMLAccessForPrincipal(String guid, String principalName, String permType, String permOrder) throws AccessException Get all xml access for a principal/permType/permOrder for a certain document- Parameters:
guid
- the id of the documentprincipalName
- the credentials of the principal in the database- Returns:
- an xml access DAO list
- Throws:
AccessException
-
addXMLAccess
public void addXMLAccess(String guid, String principalName, Long permission, String permType, String permOrder, String accessFileId, String subTreeId) throws AccessException, PermOrderException Add permissions for a given principal on a given document. If the principal already exists, bitwise OR the permission to the existing permission and update.- Parameters:
guid
- document idprincipalName
- principal credentialspermission
- permission bitmappermType
- permission typepermOrder
- permission order- Throws:
AccessException
PermOrderException
-
replaceAccess
public void replaceAccess(String guid, List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList) throws AccessException Set permissions for a given document. This means first removing all access control for the document and then adding the given rules.- Parameters:
guid
- document idxmlAccessList
- list of xml access dao objects that hold new access for the document- Throws:
AccessException
-
insertAccess
public void insertAccess(String guid, List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList) throws AccessException Set permissions for a given document. This means first removing all access control for the document and then adding the given rules.- Parameters:
guid
- document idxmlAccessList
- list of xml access dao objects that hold new access for the document- Throws:
AccessException
- if there is a problem with access rights
-
insertAccess
public void insertAccess(String guid, List<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessList, DBConnection conn) throws AccessException, SQLException Set permissions for a given document. This means first removing all access control for the document and then adding the given rules.- Parameters:
guid
- document idxmlAccessList
- list of xml access dao objects that hold new access for the documentconn
- the database connection to run the query- Throws:
AccessException
SQLException
-
removeXMLAccessForPrincipal
public void removeXMLAccessForPrincipal(String guid, String principalName, Long permission) throws AccessException Remove xml access. This modifies the access in the database for a principal for a given document. If the provided permission is exactly the same as what the principal has, the record is deleted from the database.- Parameters:
guid
- document idprincipalName
- principal credentials- Throws:
AccessException
-
deleteXMLAccessForDoc
Delete xml access. This removes all access records from the database for a given document- Parameters:
guid
- document id- Throws:
AccessException
-
deleteXMLAccessForDoc
public void deleteXMLAccessForDoc(String guid, String permType, DBConnection conn) throws AccessException, SQLException Delete xml access. This removes all access records from the database for a principal for a given document- Parameters:
guid
- document idpermType
- perm typeconn
- the db connection which will be used to run the delete query- Throws:
AccessException
SQLException
-
populateDAO
protected edu.ucsb.nceas.utilities.access.XMLAccessDAO populateDAO(ResultSet resultSet) throws SQLException Populate a job data object with the current row in a resultset- Specified by:
populateDAO
in classBaseAccess
- Parameters:
resultSet
- the result set which is already pointing to the desired row.- Returns:
- a scheduled job data object
- Throws:
SQLException
-