Class SimpleSystemPermissionSet

java.lang.Object
org.apache.guacamole.net.auth.simple.SimpleSystemPermissionSet
All Implemented Interfaces:
PermissionSet<SystemPermission>, SystemPermissionSet

public class SimpleSystemPermissionSet extends Object implements SystemPermissionSet
A read-only implementation of SystemPermissionSet which uses a backing Set of Permissions to determine which permissions are present.
  • Constructor Details

    • SimpleSystemPermissionSet

      public SimpleSystemPermissionSet()
      Creates a new empty SimpleSystemPermissionSet. If you are not extending SimpleSystemPermissionSet and only need an immutable, empty SystemPermissionSet, consider using SystemPermissionSet.EMPTY_SET instead.
    • SimpleSystemPermissionSet

      public SimpleSystemPermissionSet(Set<SystemPermission> permissions)
      Creates a new SimpleSystemPermissionSet which contains the permissions within the given Set.
      Parameters:
      permissions - The Set of permissions this SimpleSystemPermissionSet should contain.
  • Method Details

    • setPermissions

      protected void setPermissions(Set<SystemPermission> permissions)
      Sets the Set which backs this SimpleSystemPermissionSet. Future function calls on this SimpleSystemPermissionSet will use the provided Set.
      Parameters:
      permissions - The Set of permissions this SimpleSystemPermissionSet should contain.
    • getPermissions

      public Set<SystemPermission> getPermissions()
      Description copied from interface: PermissionSet
      Returns a Set which contains all permissions granted within this permission set.
      Specified by:
      getPermissions in interface PermissionSet<SystemPermission>
      Specified by:
      getPermissions in interface SystemPermissionSet
      Returns:
      A Set containing all permissions granted within this permission set.
    • hasPermission

      public boolean hasPermission(SystemPermission.Type permission) throws org.apache.guacamole.GuacamoleException
      Description copied from interface: SystemPermissionSet
      Tests whether the permission of the given type is granted.
      Specified by:
      hasPermission in interface SystemPermissionSet
      Parameters:
      permission - The permission to check.
      Returns:
      true if the permission is granted, false otherwise.
      Throws:
      org.apache.guacamole.GuacamoleException - If an error occurs while checking permissions, or if permissions cannot be checked due to lack of permissions to do so.
    • addPermission

      public void addPermission(SystemPermission.Type permission) throws org.apache.guacamole.GuacamoleException
      Description copied from interface: SystemPermissionSet
      Adds the specified permission.
      Specified by:
      addPermission in interface SystemPermissionSet
      Parameters:
      permission - The permission to add.
      Throws:
      org.apache.guacamole.GuacamoleException - If an error occurs while adding the permission, or if permission to add permissions is denied.
    • removePermission

      public void removePermission(SystemPermission.Type permission) throws org.apache.guacamole.GuacamoleException
      Description copied from interface: SystemPermissionSet
      Removes the specified permission.
      Specified by:
      removePermission in interface SystemPermissionSet
      Parameters:
      permission - The permission to remove.
      Throws:
      org.apache.guacamole.GuacamoleException - If an error occurs while removing the permission, or if permission to remove permissions is denied.
    • addPermissions

      public void addPermissions(Set<SystemPermission> permissions) throws org.apache.guacamole.GuacamoleException
      Description copied from interface: PermissionSet
      Adds the specified permissions, if not already granted. If a specified permission is already granted, no operation is performed regarding that permission.
      Specified by:
      addPermissions in interface PermissionSet<SystemPermission>
      Specified by:
      addPermissions in interface SystemPermissionSet
      Parameters:
      permissions - The permissions to add.
      Throws:
      org.apache.guacamole.GuacamoleException - If an error occurs while adding the permissions, or if permission to add permissions is denied.
    • removePermissions

      public void removePermissions(Set<SystemPermission> permissions) throws org.apache.guacamole.GuacamoleException
      Description copied from interface: PermissionSet
      Removes each of the specified permissions, if granted. If a specified permission is not granted, no operation is performed regarding that permission.
      Specified by:
      removePermissions in interface PermissionSet<SystemPermission>
      Specified by:
      removePermissions in interface SystemPermissionSet
      Parameters:
      permissions - The permissions to remove.
      Throws:
      org.apache.guacamole.GuacamoleException - If an error occurs while removing the permissions, or if permission to remove permissions is denied.