Package jmri.jmrit.permission
Class DefaultUser
- java.lang.Object
-
- jmri.jmrit.permission.DefaultUser
-
- All Implemented Interfaces:
User
public class DefaultUser extends java.lang.Object implements User
The default implementation of User.
-
-
Constructor Summary
Constructors Constructor Description DefaultUser(java.lang.String username, java.lang.String password)
DefaultUser(java.lang.String username, java.lang.String password, int priority, java.lang.String systemUserName, Role[] roles)
DefaultUser(java.lang.String username, java.lang.String passwordMD5, java.lang.String seed)
DefaultUser(DefaultUser u)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRole(Role role)
boolean
changePassword(java.lang.String oldPassword, java.lang.String newPassword)
boolean
checkPassword(java.lang.String password)
boolean
ensureAtLeastPermission(Permission permission, PermissionValue minValue)
Checks if the current user has the permission.java.lang.String
getComment()
java.lang.String
getName()
(package private) java.lang.String
getPassword()
int
getPriority()
static java.lang.String
getRandomString(int count)
java.util.Set<Role>
getRoles()
(package private) java.lang.String
getSeed()
(package private) java.lang.String
getSystemUsername()
java.lang.String
getUserName()
boolean
hasAtLeastPermission(Permission permission, PermissionValue minValue)
boolean
isPermittedToChangePassword()
Is the user allowed to change his password?boolean
isSystemUser()
void
removeRole(Role role)
void
setComment(java.lang.String comment)
void
setName(java.lang.String name)
void
setPassword(java.lang.String newPassword)
(package private) void
setPasswordMD5(java.lang.String passwordMD5)
(package private) void
setRoles(java.util.Set<Role> roles)
(package private) void
setSeed(java.lang.String seed)
-
-
-
Constructor Detail
-
DefaultUser
public DefaultUser(java.lang.String username, java.lang.String password)
-
DefaultUser
DefaultUser(DefaultUser u)
-
DefaultUser
DefaultUser(java.lang.String username, java.lang.String password, int priority, java.lang.String systemUserName, Role[] roles)
-
DefaultUser
public DefaultUser(java.lang.String username, java.lang.String passwordMD5, java.lang.String seed)
-
-
Method Detail
-
getRandomString
public static java.lang.String getRandomString(int count)
-
getUserName
public java.lang.String getUserName()
- Specified by:
getUserName
in interfaceUser
-
isSystemUser
public boolean isSystemUser()
- Specified by:
isSystemUser
in interfaceUser
-
getPriority
public int getPriority()
- Specified by:
getPriority
in interfaceUser
-
getSystemUsername
java.lang.String getSystemUsername()
-
getPassword
java.lang.String getPassword()
-
setPasswordMD5
void setPasswordMD5(java.lang.String passwordMD5)
-
getSeed
java.lang.String getSeed()
-
setSeed
void setSeed(java.lang.String seed)
-
getComment
public java.lang.String getComment()
- Specified by:
getComment
in interfaceUser
-
setComment
public void setComment(java.lang.String comment)
- Specified by:
setComment
in interfaceUser
-
removeRole
public void removeRole(Role role)
- Specified by:
removeRole
in interfaceUser
-
setPassword
public void setPassword(java.lang.String newPassword)
- Specified by:
setPassword
in interfaceUser
-
isPermittedToChangePassword
public boolean isPermittedToChangePassword()
Description copied from interface:User
Is the user allowed to change his password?- Specified by:
isPermittedToChangePassword
in interfaceUser
- Returns:
- true if the user is allowed to change his password, false otherwise.
-
changePassword
public boolean changePassword(java.lang.String oldPassword, java.lang.String newPassword)
- Specified by:
changePassword
in interfaceUser
-
checkPassword
public boolean checkPassword(java.lang.String password)
-
hasAtLeastPermission
public boolean hasAtLeastPermission(Permission permission, PermissionValue minValue)
- Specified by:
hasAtLeastPermission
in interfaceUser
-
ensureAtLeastPermission
public boolean ensureAtLeastPermission(Permission permission, PermissionValue minValue)
Description copied from interface:User
Checks if the current user has the permission. If not, show a message dialog if not headless. Otherwise log a message.- Specified by:
ensureAtLeastPermission
in interfaceUser
- Parameters:
permission
- the permission to checkminValue
- the minimum value- Returns:
- true if the user has the permission, false otherwise
-
-