Class XMLAccessAccess

java.lang.Object
edu.ucsb.nceas.metacat.shared.BaseAccess
edu.ucsb.nceas.metacat.accesscontrol.XMLAccessAccess

public class XMLAccessAccess extends BaseAccess
  • Constructor Details

  • 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 document
      principalName - 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 document
      principalName - 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 id
      principalName - principal credentials
      permission - permission bitmap
      permType - permission type
      permOrder - 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 id
      xmlAccessList - 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 id
      xmlAccessList - 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 id
      xmlAccessList - list of xml access dao objects that hold new access for the document
      conn - 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 id
      principalName - principal credentials
      Throws:
      AccessException
    • deleteXMLAccessForDoc

      public void deleteXMLAccessForDoc(String guid) throws AccessException
      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 id
      permType - perm type
      conn - 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 class BaseAccess
      Parameters:
      resultSet - the result set which is already pointing to the desired row.
      Returns:
      a scheduled job data object
      Throws:
      SQLException