Enum Class GlobalPermission

java.lang.Object
java.lang.Enum<GlobalPermission>
com.google.gerrit.server.permissions.GlobalPermission
All Implemented Interfaces:
GerritPermission, GlobalOrPluginPermission, Serializable, Comparable<GlobalPermission>, java.lang.constant.Constable

public enum GlobalPermission extends Enum<GlobalPermission> implements GlobalOrPluginPermission
Global server permissions built into Gerrit.

See also GlobalCapability which lists the equivalent strings used in the refs/meta/config settings in All-Projects.

  • Enum Constant Details

  • Method Details

    • values

      public static GlobalPermission[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static GlobalPermission valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromAnnotation

      public static Set<GlobalOrPluginPermission> fromAnnotation(String pluginName, Class<?> clazz) throws PermissionBackendException
      Extracts the @RequiresCapability or @RequiresAnyCapability annotation.
      Parameters:
      pluginName - name of the declaring plugin. May be null or "gerrit" for classes originating from the core server.
      clazz - target class to extract annotation from.
      Returns:
      empty set if no annotations were found, or a collection of permissions, any of which are suitable to enable access.
      Throws:
      PermissionBackendException - the annotation could not be parsed.
    • fromAnnotation

      public static Set<GlobalOrPluginPermission> fromAnnotation(Class<?> clazz) throws PermissionBackendException
      Throws:
      PermissionBackendException
    • describeForException

      public String describeForException()
      Description copied from interface: GerritPermission
      A description in the context of an exception message.

      Should be grammatical when used in the construction "not permitted: [description] on [resource]", although individual PermissionBackend implementations may vary the wording.

      Specified by:
      describeForException in interface GerritPermission