edu.ucsb.nceas.metacat

## Class PermissionController

- java.lang.Object
- - edu.ucsb.nceas.metacat.PermissionController

-     public class PermissionController
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PermissionController(java.lang.String myDocid)` Constructor for PermissionController

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.util.Hashtable<java.lang.String,java.lang.String>` | `getUnReadableInlineDataIdList(java.lang.String docid, java.lang.String user, java.lang.String[] groups)` A static method to get Hashtable which cointains a inlinedata object list that user can't read it.
    `static java.util.Hashtable<java.lang.String,java.lang.String>` | `getUnWritableInlineDataIdList(java.lang.String docidWithoutRev, java.lang.String user, java.lang.String[] groups, boolean withRevision)` A static method to get Hashtable which cointains a inline data object list that user can't overwrite it.
    `boolean` | `hasPermission(java.lang.String sessionId, java.lang.String myPermission)`
    `boolean` | `hasPermission(java.lang.String user, java.lang.String[] groups, java.lang.String myPermission)` Check from db connection if at least one of the list of @principals Administrators are allowed all permission
    `boolean` | `hasPermissionForSubTreeNode(java.lang.String user, java.lang.String[] groups, java.lang.String myPermission, long nodeId)` The method to determine of a node can be access by a user just by subtree access control
    `boolean` | `hasSubTreeAccessControl()` Return if a document has subtree access control
    `java.util.Hashtable` | `hasUnaccessableSubTree(java.lang.String user, java.lang.String[] groups, java.lang.String myPermission)` This method will return a hasTable of subtree which user doesn't has the permssion to access

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PermissionController

          public PermissionController(java.lang.String myDocid)
                               throws McdbException

      Constructor for PermissionController
      Parameters:
        `myDocid` - the docid need to access
      Throws:
        `McdbException`

  - ### Method Detail

    - #### hasSubTreeAccessControl

          public boolean hasSubTreeAccessControl()

      Return if a document has subtree access control

    - #### hasPermission

          public boolean hasPermission(java.lang.String sessionId,
                                       java.lang.String myPermission)
                                throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### hasPermission

          public boolean hasPermission(java.lang.String user,
                                       java.lang.String[] groups,
                                       java.lang.String myPermission)
                                throws java.sql.SQLException

      Check from db connection if at least one of the list of @principals Administrators are allowed all permission
      Parameters:
        `user` - the user name
        `groups` - the groups which the use is in
        `myPermission` - permission type to check for
      Throws:
        `java.sql.SQLException`

    - #### hasPermissionForSubTreeNode

          public boolean hasPermissionForSubTreeNode(java.lang.String user,
                                                     java.lang.String[] groups,
                                                     java.lang.String myPermission,
                                                     long nodeId)
                                              throws McdbException

      The method to determine of a node can be access by a user just by subtree access control
      Throws:
        `McdbException`

    - #### hasUnaccessableSubTree

          public java.util.Hashtable hasUnaccessableSubTree(java.lang.String user,
                                                            java.lang.String[] groups,
                                                            java.lang.String myPermission)
                                                     throws McdbException

      This method will return a hasTable of subtree which user doesn't has the permssion to access
      Parameters:
        `user` - the user name
        `groups` - the groups which the use is in
        `myPermission` - permission type to check for
      Throws:
        `McdbException`

    - #### getUnReadableInlineDataIdList

          public static java.util.Hashtable<java.lang.String,java.lang.String> getUnReadableInlineDataIdList(java.lang.String docid,
                                                                                                             java.lang.String user,
                                                                                                             java.lang.String[] groups)
                                                                                                      throws McdbException

      A static method to get Hashtable which cointains a inlinedata object list that user can't read it. The key is subtree id of inlinedata, the data is internal file name for the inline data which is stored as docid in xml_access table or data object doc id.
      Parameters:
        `docid` - (With Rev), metadata docid which should be the accessfileid in the table
        `user` - , the name of user
        `groups,` - the group which the user belong to
      Throws:
        `McdbException`

    - #### getUnWritableInlineDataIdList

          public static java.util.Hashtable<java.lang.String,java.lang.String> getUnWritableInlineDataIdList(java.lang.String docidWithoutRev,
                                                                                                             java.lang.String user,
                                                                                                             java.lang.String[] groups,
                                                                                                             boolean withRevision)
                                                                                                      throws java.lang.Exception

      A static method to get Hashtable which cointains a inline data object list that user can't overwrite it. The key is subtree id of inline data distrubition, the value is internal file name for the inline data which is stored as docid in xml_access table or data object doc id.
      Parameters:
        `docidWithoutRev,` - metadata docid which should be the accessfileid in the table
        `user` - , the name of user
        `groups,` - the group which the user belong to
      Throws:
        `java.lang.Exception`

Copyright © 2020 Regents of the University of California. All Rights Reserved.