UserMemento

Immutable serializable value holding details about a user and its roles.

API

UserMemento.java
class UserMemento {
  public static final String LOGICAL_TYPE_NAME;
  public static final String AUTHORIZED_USER_ROLE;     (1)
  UserMemento system()     (2)
  UserMemento ofName(String name)     (3)
  UserMemento ofNameAndRoles(String name, RoleMemento... roles)     (4)
  UserMemento ofNameAndRoleNames(String name, String... roleNames)     (5)
  UserMemento ofNameAndRoleNames(String name, List<String> roleNames)     (6)
  UserMemento ofNameAndRoleNames(String name, Stream<String> roleNames)     (7)
  String nameFormatted()
  List<RoleMemento> getRoles()     (8)
  UserMemento withRoleAdded(String role)
  boolean isCurrentUser(String userName)     (9)
  Stream<String> streamRoleNames()
  boolean hasRoleName(String roleName)
  boolean hasSudoAccessAllRole()     (10)
  UserMementoBuilder asBuilder()
  UserLocale asUserLocale()
}
1 AUTHORIZED_USER_ROLE

Also used by the wicket-viewer and its AuthorizeInstantiation(…​) annotations; the actual value is arbitrary; however, we use namespace style to clarify the origin

2 system()

The framework’s internal user with unrestricted privileges.

3 ofName(String)

Creates a new user with the specified name and no roles.

4 ofNameAndRoles(String, RoleMemento)

Creates a new user with the specified name and assigned roles.

5 ofNameAndRoleNames(String, String)

Creates a new user with the specified name and assigned role names.

6 ofNameAndRoleNames(String, List)

Creates a new user with the specified name and assigned role names.

7 ofNameAndRoleNames(String, Stream)

Creates a new user with the specified name and assigned role names.

8 getRoles()

The roles associated with this user.

9 isCurrentUser(String)

Determine if the specified name is this user.

10 hasSudoAccessAllRole()

Whether this UserMemento 's UserMemento#getRoles() roles contains the SudoService 's SudoService#ACCESS_ALL_ROLE ACCESS_ALL_ROLE role (meaning that security checks are disabled).

Members

AUTHORIZED_USER_ROLE

Also used by the wicket-viewer and its AuthorizeInstantiation(…​) annotations; the actual value is arbitrary; however, we use namespace style to clarify the origin

system()

The framework’s internal user with unrestricted privileges.

ofName(String)

Creates a new user with the specified name and no roles.

ofNameAndRoles(String, RoleMemento)

Creates a new user with the specified name and assigned roles.

ofNameAndRoleNames(String, String)

Creates a new user with the specified name and assigned role names.

ofNameAndRoleNames(String, List)

Creates a new user with the specified name and assigned role names.

ofNameAndRoleNames(String, Stream)

Creates a new user with the specified name and assigned role names.

getRoles()

The roles associated with this user.

isCurrentUser(String)

Determine if the specified name is this user.

hasSudoAccessAllRole()

Whether this UserMemento 's UserMemento#getRoles() roles contains the SudoService 's SudoService#ACCESS_ALL_ROLE ACCESS_ALL_ROLE role (meaning that security checks are disabled).