Class SingleFileAuthoriser

java.lang.Object
gda.jython.authoriser.SingleFileAuthoriser
All Implemented Interfaces:
Authoriser

public class SingleFileAuthoriser extends Object implements Authoriser
Authoriser implementation that reads authorisation level and staff status from the same xml file. File should be of the form
 
 <permissions>
   <user fedid="fed12345" level="3" staff="true" />
   <user fedid="abc54321" level="2" />
 </permissions>
 
 
  • Any non "user" elements are ignored
  • Any entries without a fedid attribute are ignored
  • "staff" is optional and defaults to false
  • "level" is optional and defaults to 1 (usually the default anyway)
  • Constructor Details

    • SingleFileAuthoriser

      public SingleFileAuthoriser() throws org.apache.commons.configuration.ConfigurationException, IOException
      Throws:
      org.apache.commons.configuration.ConfigurationException
      IOException
    • SingleFileAuthoriser

      public SingleFileAuthoriser(String directory, String filename) throws org.apache.commons.configuration.ConfigurationException, IOException
      Throws:
      org.apache.commons.configuration.ConfigurationException
      IOException
  • Method Details

    • getAuthorisationLevel

      public int getAuthorisationLevel(String username)
      Specified by:
      getAuthorisationLevel in interface Authoriser
      Parameters:
      username -
      Returns:
      the authorisation level for the given username for this GDA installation
    • isLocalStaff

      public boolean isLocalStaff(String username)
      Description copied from interface: Authoriser
      Returns true if the username is a member of facility staff and should have elevated privileges over users. Any accounts used for beamline testing/commissioning should also return true when using this method.
      Specified by:
      isLocalStaff in interface Authoriser
      Parameters:
      username -
      Returns:
      the username is in a separate list for beamline staff
    • userFromNode

      public Optional<gda.jython.authoriser.SingleFileAuthoriser.User> userFromNode(org.apache.commons.configuration.tree.ConfigurationNode node)