Class XSAccessController


  • public class XSAccessController
    extends java.lang.Object
    This class provides authorization functions to check the privilege on the ACL based on the session.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkAcl​(Session session, byte[] acls, java.lang.String privilege)
      Checks for a privilege.
      static boolean checkAcl​(Session session, byte[] acls, java.util.List<java.lang.String> privileges)
      Checks for multiple privileges.
      static boolean checkAcl​(Session session, AclId acls, java.lang.String privilege)
      Checks for a privilege.
      static boolean checkAcl​(Session session, AclId acls, java.util.List<java.lang.String> privileges)
      Checks for mutiple privileges.
      static java.util.Collection<java.lang.String> getPrivileges​(Session session, byte[] aclId)
      Returns a collection of privileges, which is granted in the specified ACL (byte[]), based on the specified session.
      static java.util.Collection<java.lang.String> getPrivileges​(Session session, AclId aclId)
      Returns a collection of privileges, which is granted in the specified ACL (AclId), based on the specified session.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XSAccessController

        public XSAccessController()
    • Method Detail

      • checkAcl

        public static boolean checkAcl​(Session session,
                                       AclId acls,
                                       java.util.List<java.lang.String> privileges)
                                throws java.sql.SQLException,
                                       XSException,
                                       NotAttachedException
        Checks for mutiple privileges. The privilege is checked against one or multiple ACLs defined in the AclId object. This function returns true only when all the privileges are granted in the specified ACLs. It is important to note that all privileges need not be granted in a single ACL.
        Parameters:
        session - Session
        acls - ACLs
        privileges - a list of privilege names
        Returns:
        true if the privilege is grant in all ACLs; otherwise false.
        Throws:
        java.sql.SQLException - when a JDBC exception is thrown
        NotAttachedException - session not attached
        XSException - a generic error is detected
      • checkAcl

        public static boolean checkAcl​(Session session,
                                       AclId acls,
                                       java.lang.String privilege)
                                throws java.sql.SQLException,
                                       XSException,
                                       NotAttachedException
        Checks for a privilege. The privilege is checked against one or multiple ACLs defined in the AclId object
        Parameters:
        session - Session
        acls - ACLs
        privilege - the name of the privilege as String
        Returns:
        true if the privilege is granted in one of the gieven ACLs; otherwise false.
        Throws:
        java.sql.SQLException - when a JDBC exception is thrown
        NotAttachedException - session not attached
        XSException - a generic error is detected
      • checkAcl

        public static boolean checkAcl​(Session session,
                                       byte[] acls,
                                       java.util.List<java.lang.String> privileges)
                                throws java.sql.SQLException,
                                       XSException,
                                       NotAttachedException
        Checks for multiple privileges. The ACL is given in raw (byte[]) format retrived from query, which internally may have one or many ACLs. This function returns true only when all the privileges are granted in the specified ACLs. It is important to note that all privileges need not be granted in a single ACL.
        Parameters:
        session - Session
        acls - ACLs in raw format
        privileges - list of privilege names
        Returns:
        true if all privileges are granted in the ACLs; otherwise false.
        Throws:
        java.sql.SQLException - when a JDBC exception is thrown
        NotAttachedException - the session is not attached
        XSException - a generic error is detected
      • checkAcl

        public static boolean checkAcl​(Session session,
                                       byte[] acls,
                                       java.lang.String privilege)
                                throws java.sql.SQLException,
                                       XSException,
                                       NotAttachedException
        Checks for a privilege. The privilege is checked against one or multiple ACLs in raw (byte[]) format retrived from query.
        Parameters:
        session - Session
        acls - ACLs in raw format
        privilege - the name of the privilege as String
        Returns:
        true if the privilege is granted in one of the gieven ACLs; otherwise false.
        Throws:
        java.sql.SQLException - when a JDBC exception is thrown
        NotAttachedException - the session is not attached
        XSException - a generic error is detected
      • getPrivileges

        public static java.util.Collection<java.lang.String> getPrivileges​(Session session,
                                                                           AclId aclId)
                                                                    throws java.sql.SQLException,
                                                                           XSException,
                                                                           NotAttachedException
        Returns a collection of privileges, which is granted in the specified ACL (AclId), based on the specified session.
        Parameters:
        session - Session
        aclId - AclId
        Returns:
        collection of privilege names in String
        Throws:
        java.sql.SQLException - when a JDBC exception is thrown
        NotAttachedException - session not attached
        XSException - a generic error is detected
      • getPrivileges

        public static java.util.Collection<java.lang.String> getPrivileges​(Session session,
                                                                           byte[] aclId)
                                                                    throws java.sql.SQLException,
                                                                           XSException,
                                                                           NotAttachedException
        Returns a collection of privileges, which is granted in the specified ACL (byte[]), based on the specified session.
        Parameters:
        session - Session
        aclId - byte[]
        Returns:
        collection of privilege names in String
        Throws:
        java.sql.SQLException - when a JDBC exception is thrown
        NotAttachedException - session not attached
        XSException - a generic error is detected