Class UserGroup

java.lang.Object
io.goobi.viewer.model.security.user.AbstractLicensee
io.goobi.viewer.model.security.user.UserGroup
All Implemented Interfaces:
ILicensee, Serializable

@Entity public class UserGroup extends AbstractLicensee implements Serializable
Represents a group of users that can be assigned licences and roles collectively.
See Also:
  • Constructor Details

    • UserGroup

      public UserGroup()
  • Method Details

    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • addMember

      public boolean addMember(User user, Role role) throws PresentationException, DAOException
      Adds membership relation between the given user and role and persists immediately.
      Parameters:
      user - User to add
      role - Role to add
      Returns:
      true if persistence successful, false otherwise
      Throws:
      PresentationException - if any.
      DAOException - if any.
    • changeMemberRole

      public boolean changeMemberRole(User user, Role role)
      changeMemberRole.
      Parameters:
      user - user whose role to update in this group
      role - new role to assign to the user
      Returns:
      true if the role was changed successfully (i.e. both user and role are non-null), false otherwise
    • removeMember

      public boolean removeMember(User user) throws DAOException
      Remove User from Group.
      Parameters:
      user - user to remove from this group
      Returns:
      true if the user was removed (i.e. the user argument is non-null), false otherwise
      Throws:
      DAOException - if any.
    • hasUserPrivilege

      public boolean hasUserPrivilege(String privilegeName) throws DAOException
      hasUserPrivilege.
      Parameters:
      privilegeName - name of the privilege to check
      Returns:
      true if any member role of this group grants the given privilege, false otherwise
      Throws:
      DAOException - if any.
    • getId

      public Long getId()
      Getter for the field id.
      Returns:
      the database identifier of this user group
    • setId

      public void setId(Long id)
      Setter for the field id.
      Parameters:
      id - the database identifier to set
    • getName

      public String getName()
      getName.
      Specified by:
      getName in interface ILicensee
      Returns:
      the name of this licensee
    • setName

      public void setName(String name)
      Setter for the field name.
      Parameters:
      name - the display name of this user group to set
    • getDescription

      public String getDescription()
      Getter for the field description.
      Returns:
      a human-readable description of this user group
    • setDescription

      public void setDescription(String description)
      Setter for the field description.
      Parameters:
      description - a human-readable description of this user group to set
    • getAccessType

      public License.AccessType getAccessType()
      Specified by:
      getAccessType in interface ILicensee
      Returns:
      AccessType corresponding to the licensee's class
    • getOwner

      public User getOwner()
      Getter for the field owner.
      Returns:
      the user who owns this group
    • setOwner

      public void setOwner(User owner)
      Setter for the field owner.
      Parameters:
      owner - the user who owns this group to set
    • isActive

      public boolean isActive()
      isActive.
      Returns:
      true if this user group is active, false otherwise
    • setActive

      public void setActive(boolean active)
      Setter for the field active.
      Parameters:
      active - true if this user group is active; false otherwise
    • isHasMembers

      public boolean isHasMembers() throws DAOException
      Returns:
      true if group has members other than the owner; false otherwise
      Throws:
      DAOException
    • getMemberCount

      public long getMemberCount() throws DAOException
      Returns:
      number of members in this group
      Throws:
      DAOException
    • getMemberships

      public List<UserRole> getMemberships() throws DAOException
      getMemberships.
      Returns:
      a list of user role entries representing the members of this group
      Throws:
      DAOException - if any.
    • setMemberships

      public void setMemberships(List<UserRole> memberships)
    • getMembers

      public Set<User> getMembers() throws DAOException
      getMembers.
      Returns:
      the set of all users that are members of this group
      Throws:
      DAOException - if any.
    • getMembersAndOwner

      public Set<User> getMembersAndOwner() throws DAOException
      Returns:
      Set
      Throws:
      DAOException
    • toString

      public String toString()
      Overrides:
      toString in class Object