Class AbstractUser
- java.lang.Object
-
- org.apache.guacamole.net.auth.AbstractIdentifiable
-
- org.apache.guacamole.net.auth.AbstractUser
-
- All Implemented Interfaces:
Attributes
,Identifiable
,Permissions
,ReadableAttributes
,User
- Direct Known Subclasses:
SimpleUser
public abstract class AbstractUser extends AbstractIdentifiable implements User
Base implementation of User which provides default implementations of most functions.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.guacamole.net.auth.User
User.Attribute
-
-
Constructor Summary
Constructors Constructor Description AbstractUser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectPermissionSet
getActiveConnectionPermissions()
Returns all permissions given to this object regarding currently-active connections.Map<String,String>
getAttributes()
Returns all attributes associated with this object.ObjectPermissionSet
getConnectionGroupPermissions()
Returns all connection group permissions given to this object.ObjectPermissionSet
getConnectionPermissions()
Returns all connection permissions given to this object.Permissions
getEffectivePermissions()
Returns a read-only view of all permissions granted to this user.Date
getLastActive()
Returns the date and time that this user was last active.String
getPassword()
Returns this user's password.ObjectPermissionSet
getSharingProfilePermissions()
Returns all sharing profile permissions given to this object.SystemPermissionSet
getSystemPermissions()
Returns all system-level permissions given to this object.ObjectPermissionSet
getUserGroupPermissions()
Returns all user group permissions given to this object.RelatedObjectSet
getUserGroups()
Returns a set of all readable user groups of which this user is a member.ObjectPermissionSet
getUserPermissions()
Returns all user permissions given to this object.void
setAttributes(Map<String,String> attributes)
Sets the given attributes.void
setPassword(String password)
Sets this user's password.-
Methods inherited from class org.apache.guacamole.net.auth.AbstractIdentifiable
equals, getIdentifier, hashCode, setIdentifier
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.guacamole.net.auth.Identifiable
getIdentifier, setIdentifier
-
Methods inherited from interface org.apache.guacamole.net.auth.User
getHistory, getUserHistory
-
-
-
-
Method Detail
-
getPassword
public String getPassword()
Description copied from interface:User
Returns this user's password. Note that the password returned may be hashed or completely arbitrary.- Specified by:
getPassword
in interfaceUser
- Returns:
- A String which may (or may not) be the user's password.
-
setPassword
public void setPassword(String password)
Description copied from interface:User
Sets this user's password. Note that while this function is guaranteed to change the password of this User object, there is no guarantee that getPassword() will return the value given to setPassword().- Specified by:
setPassword
in interfaceUser
- Parameters:
password
- The password to set.
-
getAttributes
public Map<String,String> getAttributes()
Returns all attributes associated with this object. The returned map may not be modifiable.This implementation simply an immutable, empty map. Implementations that wish to expose custom attributes should override this function.
- Specified by:
getAttributes
in interfaceReadableAttributes
- Returns:
- A map of all attribute identifiers to their corresponding values, for all attributes associated with this object, which may not be modifiable.
-
setAttributes
public void setAttributes(Map<String,String> attributes)
Sets the given attributes. If an attribute within the map is not supported, it will simply be dropped. Any attributes not within the given map will be left untouched. Attributes which are not declared within the associated UserContext MUST NOT be submitted, but other extensions may manipulate the declared attributes through decorate() and redecorate(). Implementations may optionally allow storage of unsupported attributes. Extensions which rely on other extensions to store their attribute values should verify that such storage is supported by first testing that the attribute value is retrievable via getAttributes() after being set.This implementation simply ignores all attributes given. Implementations that wish to support modification of custom attributes should override this function.
- Specified by:
setAttributes
in interfaceAttributes
- Parameters:
attributes
- A map of all attribute identifiers to their corresponding values.
-
getLastActive
public Date getLastActive()
Returns the date and time that this user was last active. If the user was never active, the time that the user was last active is unknown, or this information is not visible to the current user, this may be null.This implementation simply returns
null
. Implementations that wish to expose the date and time that a user was last active should override this function.- Specified by:
getLastActive
in interfaceUser
- Returns:
- The date and time this user was last active, or null if this information is unavailable or inapplicable.
-
getSystemPermissions
public SystemPermissionSet getSystemPermissions() throws org.apache.guacamole.GuacamoleException
Returns all system-level permissions given to this object.This implementation simply an immutable, empty permission set. Implementations that wish to expose permissions should override this function.
- Specified by:
getSystemPermissions
in interfacePermissions
- Returns:
- A SystemPermissionSet of all system-level permissions granted to this object.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
getConnectionPermissions
public ObjectPermissionSet getConnectionPermissions() throws org.apache.guacamole.GuacamoleException
Returns all connection permissions given to this object.This implementation simply an immutable, empty permission set. Implementations that wish to expose permissions should override this function.
- Specified by:
getConnectionPermissions
in interfacePermissions
- Returns:
- An ObjectPermissionSet of all connection permissions granted to this object.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
getConnectionGroupPermissions
public ObjectPermissionSet getConnectionGroupPermissions() throws org.apache.guacamole.GuacamoleException
Returns all connection group permissions given to this object.This implementation simply an immutable, empty permission set. Implementations that wish to expose permissions should override this function.
- Specified by:
getConnectionGroupPermissions
in interfacePermissions
- Returns:
- An ObjectPermissionSet of all connection group permissions granted to this object.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
getUserPermissions
public ObjectPermissionSet getUserPermissions() throws org.apache.guacamole.GuacamoleException
Returns all user permissions given to this object.This implementation simply an immutable, empty permission set. Implementations that wish to expose permissions should override this function.
- Specified by:
getUserPermissions
in interfacePermissions
- Returns:
- An ObjectPermissionSet of all user permissions granted to this object.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
getUserGroupPermissions
public ObjectPermissionSet getUserGroupPermissions() throws org.apache.guacamole.GuacamoleException
Returns all user group permissions given to this object.This implementation simply an immutable, empty permission set. Implementations that wish to expose permissions should override this function.
- Specified by:
getUserGroupPermissions
in interfacePermissions
- Returns:
- An ObjectPermissionSet of all user group permissions granted to this object.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
getActiveConnectionPermissions
public ObjectPermissionSet getActiveConnectionPermissions() throws org.apache.guacamole.GuacamoleException
Returns all permissions given to this object regarding currently-active connections.This implementation simply an immutable, empty permission set. Implementations that wish to expose permissions should override this function.
- Specified by:
getActiveConnectionPermissions
in interfacePermissions
- Returns:
- An ObjectPermissionSet of all active connection permissions granted to this object.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
getSharingProfilePermissions
public ObjectPermissionSet getSharingProfilePermissions()
Returns all sharing profile permissions given to this object.This implementation simply an immutable, empty permission set. Implementations that wish to expose permissions should override this function.
- Specified by:
getSharingProfilePermissions
in interfacePermissions
- Returns:
- An ObjectPermissionSet of all sharing profile permissions granted to this object.
-
getUserGroups
public RelatedObjectSet getUserGroups() throws org.apache.guacamole.GuacamoleException
Returns a set of all readable user groups of which this user is a member. If permission is granted for the current user to modify the membership of this user, then the returned set will be mutable, and any such modifications should be made through changes to the returned set.This implementation simply an immutable, empty related object set. Implementations that wish to expose group membership should override this function.
- Specified by:
getUserGroups
in interfaceUser
- Returns:
- The set of all readable user groups of which this user is a member.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving the user groups.
-
getEffectivePermissions
public Permissions getEffectivePermissions() throws org.apache.guacamole.GuacamoleException
Returns a read-only view of all permissions granted to this user. The exact semantics of what permissions are granted are up to the implementation, and the permissions within this view may be implied, derived dynamically, inherited through multiple levels of group membership, etc.This implementation simply returns
this
. Implementations that wish to expose permissions which apply indirectly (such as through group inheritance) should override this function.- Specified by:
getEffectivePermissions
in interfaceUser
- Returns:
- A read-only view of the permissions which are granted to this user.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
-