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

    Constructors
    Constructor
    Description
    Construct an instance of the AccessControlForSingleFile class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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 docid
    getAccessString(Vector<edu.ucsb.nceas.utilities.access.XMLAccessDAO> xmlAccessDAOList)
    Put together an xml representation of the objects in a given access dao list
    getACL(String user, String[] groups)
    Get 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 object
    void
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AccessControlForSingleFile

      public AccessControlForSingleFile(String accessionNumber) throws AccessControlException
      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 credentials
      permission - the permission
      permType - the permission type
      permOrder - the permission order
      Throws:
      AccessControlException
      PermOrderException
    • insertPermissions

      public void insertPermissions(String accessBlock) throws AccessControlException
      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

      public String getACL(String user, String[] groups) throws AccessControlException
      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 system
      groups - names of user's groups to which user belongs
      Throws:
      AccessControlException
    • getAccessString

      public String getAccessString() throws AccessControlException
      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