Enum GlobalPermission

    • Method Detail

      • values

        public static GlobalPermission[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (GlobalPermission c : GlobalPermission.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static GlobalPermission valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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.
      • 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