Class PermissionSubject

Object
PermissionSubject
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
PermissionSubject.Anyone, PermissionSubject.JiraGroup, PermissionSubject.JiraUser, PermissionSubject.ProjectRole

public abstract class PermissionSubject extends Object implements Cloneable

PermissionSubject is an abstraction used to specify which users a particular permission is applicable to. All possible sub-classes of PermissionSubject are listed in this class, and other implementation are not supported because Structure needs to serialize and deserialize permission subjects.

Author:
Igor Sereda
See Also:
  • Constructor Details

    • PermissionSubject

      public PermissionSubject()
  • Method Details

    • matches

      public abstract boolean matches(@Nullable ApplicationUser user)
    • toEncodedString

      public abstract String toEncodedString()
      Returns:
      a string representation of this permission subject
      See Also:
    • fromEncodedString

      @Nullable public static PermissionSubject fromEncodedString(@Nullable String s) throws ParseException
      Creates a PermissionSubject based on the string representation. Null parameter yields null result. Use this method only if user keys were used to encode user permissions.
      Parameters:
      s - string representation of the PermissionSubject
      Returns:
      decoded PermissionSubject, or null if s was null or an empty string.
      Throws:
      ParseException - if s was not null neither empty, but the code failed to decipher the string
      See Also:
    • fromEncodedString

      @Nullable public static PermissionSubject fromEncodedString(@Nullable String s, boolean usersAsUserNames) throws ParseException
      Creates a PermissionSubject based on the string representation. Null parameter yields null result.
      Parameters:
      s - string representation of the PermissionSubject
      usersAsUserNames - true if user names were used to encode user permissions (Structure version was less than 2.3), false if user keys were used instead.
      Returns:
      decoded PermissionSubject, or null if s was null or an empty string.
      Throws:
      ParseException - if s was not null neither empty, but the code failed to decipher the string
    • clone

      public PermissionSubject clone()
      Overrides:
      clone in class Object
      Returns:
      a clone of this subject
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • visit

      @Nullable public abstract <T> T visit(PermissionSubject.Visitor<T> visitor, @Nullable T carry)
      Calls an appropriate visitor method, passing this PermissionSubject and the carry parameter.
      Returns:
      the result of the call
      Since:
      7.2.0 (Structure 2.0)
    • clone

      @Nullable public static PermissionSubject clone(@Nullable PermissionSubject owner)