Class CheckUserPrivileges

  • All Implemented Interfaces:
    java.lang.Iterable<CheckUserPrivileges.Candidate>

    public class CheckUserPrivileges
    extends XMLRequest
    implements java.lang.Iterable<CheckUserPrivileges.Candidate>
    Checks privileges of users. For each privilege to check a new instance of CheckUserPrivileges.Candidate needs to be created. The iterator of this class can be used to get the results of the check the request has been sent to the Automation Engine.

    Example:

            CheckUserPrivileges.Candidate user1 = new CheckUserPrivileges.Candidate(new UC4UserName("ANG/DEV"), Privilege.ACCESS_NOFOLDER);
        CheckUserPrivileges.Candidate user2 = new CheckUserPrivileges.Candidate(new UC4UserName("ANG/DEV"), Privilege.ILM_ACTIONS); 
            
        CheckUserPrivileges check = new CheckUserPrivileges(user1, user2);
        uc4.sendRequestAndWait(check);
        
            for (CheckUserPrivileges.Candidate c : check) {
            if (c.getResult()) {
                    System.out.println("User "+c.getUser()+" holds the privilege "+c.getPrivilege());                       
            } else {
                    System.out.println("User "+c.getUser()+" does not hold the privilege "+c.getPrivilege());
            }               
        }           
            
    • Constructor Detail

      • CheckUserPrivileges

        public CheckUserPrivileges​(CheckUserPrivileges.Candidate... candidates)
        Creates a new CheckUserPrivileges request.
        Parameters:
        candidates - Candidates to test
    • Method Detail

      • createRequest

        protected void createRequest​(com.uc4.util.XMLDocument doc,
                                     org.w3c.dom.Element request,
                                     ConnectionAttributes sessionInfo)
        Description copied from class: XMLRequest
        Creates the XML Document for the request. This method is used internally.
        Specified by:
        createRequest in class XMLRequest
        Parameters:
        doc - Document, used to create new Elements
        request - Request Element - classes append information to this request element
        sessionInfo - Information about the session
      • handleContent

        protected void handleContent​(com.uc4.util.XMLDocument doc,
                                     ConnectionAttributes session)
        Description copied from class: XMLRequest
        Sub classes extract the values from the XML document and provide public getter methods.
        Overrides:
        handleContent in class XMLRequest
        Parameters:
        doc - XML Document
        session - Info about the user session
      • getSrc

        protected java.lang.String getSrc()
        Description copied from class: XMLRequest
        Returns the request source. This method is used internally.
        Specified by:
        getSrc in class XMLRequest
        Returns:
        Source
      • size

        public int size()
        Returns the number of candidates.
        Returns:
        Size
      • isAllowedInClientZero

        protected boolean isAllowedInClientZero()
        Description copied from class: XMLRequest
        This method is used internally. Tests if this XMLRequest is allowed in client 0. The default implementation returns false, subclasses may override.
        Overrides:
        isAllowedInClientZero in class XMLRequest
        Returns:
        true if this request is allowed in client 0, false otherwise