Class SimpleUserData

    • Constructor Detail

      • SimpleUserData

        public SimpleUserData​(long id,
                              String username,
                              String name)
    • Method Detail

      • getId

        public long getId()
        Description copied from interface: User
        Returns user id
        Specified by:
        getId in interface User
        Returns:
        user id
      • getRealm

        public String getRealm()
        Description copied from interface: User
        Returns realm of the user.
        Specified by:
        getRealm in interface User
        Returns:
        realm of the user
      • getUsername

        public String getUsername()
        Description copied from interface: User
        Returns username of this user
        Specified by:
        getUsername in interface User
        Returns:
        username
      • getName

        public String getName()
        Description copied from interface: User
        Returns full name of this user
        Specified by:
        getName in interface User
        Returns:
        user full name
      • getEmail

        public String getEmail()
        Description copied from interface: User
        Returns e-mail of this user
        Specified by:
        getEmail in interface User
        Returns:
        email address
      • getDescriptiveName

        public String getDescriptiveName()
        Description copied from interface: User
        Returns full name of the user if it is not empty, otherwise returns username.
        Specified by:
        getDescriptiveName in interface User
        Returns:
        full name or username if full name is empty
      • getExtendedName

        public String getExtendedName()
        Specified by:
        getExtendedName in interface User
        Returns:
        user full name and username in the form: <full name> (<username>)
      • getLastLoginTimestamp

        public Date getLastLoginTimestamp()
        Description copied from interface: User
        Returns this user last login timestamp
        Specified by:
        getLastLoginTimestamp in interface User
        Returns:
        last login timestamp
      • getPropertyValue

        public String getPropertyValue​(PropertyKey propertyKey)
        Description copied from interface: PropertyHolder
        Returns value of the property with specified key
        Specified by:
        getPropertyValue in interface PropertyHolder
        Parameters:
        propertyKey - value of the property with specified key
        Returns:
        value of the property with specified key
      • getBooleanProperty

        public boolean getBooleanProperty​(PropertyKey propertyKey)
        Description copied from interface: PropertyHolder
        Returns value of the boolean property
        Specified by:
        getBooleanProperty in interface PropertyHolder
        Parameters:
        propertyKey - property key
        Returns:
        value
      • getVisibleProjects

        public List<String> getVisibleProjects()
        Description copied from interface: User
        Computes list of visible projects sorted according to the order specified by user.
        Specified by:
        getVisibleProjects in interface User
        Returns:
        list of visible projects ids
      • getAllProjects

        public List<String> getAllProjects()
        Description copied from interface: User
        Returns all projects sorted according to the order specified by user.
        Specified by:
        getAllProjects in interface User
        Returns:
        list of all of the projects ids
      • isPermissionGrantedGlobally

        public boolean isPermissionGrantedGlobally​(@NotNull
                                                   Permission permission)
        Description copied from interface: AuthorityHolder
        Returns true if specified permission granted globally (i.e. not associated with any particular object)
        Specified by:
        isPermissionGrantedGlobally in interface AuthorityHolder
        Parameters:
        permission - permission to check
        Returns:
        true or false
      • getGlobalPermissions

        @NotNull
        public Permissions getGlobalPermissions()
        Description copied from interface: AuthorityHolder
        Returns all granted non-project related permissions and all project-related permissions granted globally
        Specified by:
        getGlobalPermissions in interface AuthorityHolder
        Returns:
        see above
      • getProjectsPermissions

        @NotNull
        public Map<String,​Permissions> getProjectsPermissions()
        Description copied from interface: AuthorityHolder
        Returns map of project-related permissions that were granted for a particular project. Project internal id is used as the key.
        Specified by:
        getProjectsPermissions in interface AuthorityHolder
        Returns:
        map of project permissions
      • isPermissionGrantedForProject

        public boolean isPermissionGrantedForProject​(@NotNull
                                                     String projectId,
                                                     @NotNull
                                                     Permission permission)
        Description copied from interface: AuthorityHolder
        Returns true if permission is granted for a project, i.e. the result is true if there is a project related permission granted globally or for specified project
        Specified by:
        isPermissionGrantedForProject in interface AuthorityHolder
        Parameters:
        projectId - project internal id
        permission - permission to check
        Returns:
        see above
      • isPermissionGrantedForAnyProject

        public boolean isPermissionGrantedForAnyProject​(@NotNull
                                                        Permission permission)
        Description copied from interface: AuthorityHolder
        Returns true if specified permission is granted for at least one project
        Specified by:
        isPermissionGrantedForAnyProject in interface AuthorityHolder
        Parameters:
        permission - permission to check
        Returns:
        see above
      • getPermissionsGrantedForProject

        @NotNull
        public Permissions getPermissionsGrantedForProject​(@NotNull
                                                           String projectId)
        Description copied from interface: AuthorityHolder
        Returns all permissions granted for particular project. These include permissions granted specifically for the specified project and granted global project-related permissions (i.e. permissions supporting project association Permission.isProjectAssociationSupported()).
        Specified by:
        getPermissionsGrantedForProject in interface AuthorityHolder
        Parameters:
        projectId - project internal id
        Returns:
        all granted permissions for particular project
      • getPermissionsGrantedForAllProjects

        @NotNull
        public Permissions getPermissionsGrantedForAllProjects​(@NotNull
                                                               Collection<String> projectIds)
        Description copied from interface: AuthorityHolder
        Returns all permissions granted for all projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project association Permission.isProjectAssociationSupported()).
        Specified by:
        getPermissionsGrantedForAllProjects in interface AuthorityHolder
        Parameters:
        projectIds - collection of project internal ids
        Returns:
        all granted permissions for all projects
      • getPermissionsGrantedForAnyOfProjects

        @NotNull
        public Permissions getPermissionsGrantedForAnyOfProjects​(@NotNull
                                                                 Collection<String> projectIds)
        Description copied from interface: AuthorityHolder
        Returns union of permissions granted for projects from the collection. These include permissions granted specifically for the specified projects and granted global project-related permissions (i.e. permissions supporting project association Permission.isProjectAssociationSupported()).
        Specified by:
        getPermissionsGrantedForAnyOfProjects in interface AuthorityHolder
        Parameters:
        projectIds - collection of project internal ids
        Returns:
        all granted permissions for all projects
      • getAssociatedUser

        @Nullable
        public User getAssociatedUser()
        Description copied from interface: AuthorityHolder
        Returns the user object associated with the principal.
        Specified by:
        getAssociatedUser in interface AuthorityHolder
        Returns:
        may be null if the authority holder is not a user.
      • hasAllPermissionsOf

        public boolean hasAllPermissionsOf​(@NotNull
                                           AuthorityHolder authorityHolder)
        Description copied from interface: AuthorityHolder
        Returns true if this authority holder has all permissions of another authority holder.
        Specified by:
        hasAllPermissionsOf in interface AuthorityHolder
        Returns:
        see above
      • createSimpleUserDataOn

        @NotNull
        public static SimpleUserData createSimpleUserDataOn​(@NotNull
                                                            User user)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • describe

        @NotNull
        public String describe​(boolean verbose)
        Specified by:
        describe in interface Loggable
        Parameters:
        verbose - verbosity of object description
        Returns:
        description of this object. If verbose is true, description should have mode details.