com.tle.common.scripting.objects
Interface UserScriptObject
Declaration: public interface UserScriptObject extends ScriptObject
All Superinterfaces: ScriptObject, java.io.Serializable

 

Referenced by the 'user' variable in script. Represents the currently logged in user as well as provide an interface into the user service to retrieve information about groups and roles. This is the SAME as CommonUserScriptObject

 

 

Fields Summary
static java.lang.String DEFAULT_VARIABLE
    

 

 

Methods Summary
abstract boolean doesntHaveRole(java.lang.String roleUniqueID)
    
Opposite of hasRole.
abstract java.lang.String getEmail()
    
abstract java.lang.String getFirstName()
    
abstract java.lang.String[] getGroupIds()
    
Deprecated. Use getGroups() instead
abstract java.lang.String[] getGroupNames()
    
Deprecated. Use getGroups() instead
abstract java.util.List<GroupScriptType> getGroups()
    
Gets all the groups the logged in user belongs to
abstract java.util.List<GroupScriptType> getGroupsContainingUser(java.lang.String userUniqueID)
    
Get a list of groups that the user identified by userUniqueID belongs to.
abstract java.lang.String getID()
    
abstract java.util.List<GroupScriptType> getInformationForGroups(java.lang.String[] groupUniqueIDs)
    
Resolve the list of groupUniqueIDs into a list of GroupScriptType objects.
abstract java.util.List<UserScriptType> getInformationForUsers(java.lang.String[] userUniqueIDs)
    
Resolve the list of userUniqueIDs into a list of UserScriptType objects.
abstract java.lang.String getLastName()
    
abstract java.lang.String getUsername()
    
abstract boolean hasRole(java.lang.String roleUniqueID)
    
Determines if the logged in user has the role with the uuid of roleUniqueID
abstract boolean isMemberOfGroup(java.lang.String groupUniqueID)
    
Determines if the logged in user is a member of the group with the uuid of groupUniqueID
abstract java.util.List<GroupScriptType> searchGroups(java.lang.String query)
    
Find all groups with a name matching the query.
abstract java.util.List<RoleScriptType> searchRoles(java.lang.String query)
    
Find all roles with a name matching the query.
abstract java.util.List<UserScriptType> searchUsers(java.lang.String query)
    
The user fields the query is matched with is User Management plugin dependent, but generally will attempt to match with username, first name, last name.
abstract java.util.List<UserScriptType> searchUsersInGroups(java.lang.String query, java.lang.String groupUniqueID, boolean recursive)
    
Same as searchUsers(String) but allows to filter the results by a group ID, and whether to search for subgroups of the specified group.

 

Methods inherited from interface: com.tle.common.scripting.ScriptObject
scriptEnter, scriptExit

 

 

 

 

DEFAULT_VARIABLE

 

public static final java.lang.String DEFAULT_VARIABLE

 

See also: Constants

 

 

 

 

getFirstName

 

public abstract java.lang.String getFirstName( )

 

Returns:
The given name of the logged in user.

 

 

 

getLastName

 

public abstract java.lang.String getLastName( )

 

Returns:
The family name of the logged in user.

 

 

 

getUsername

 

public abstract java.lang.String getUsername( )

 

Returns:
The login name of the logged in user.

 

 

 

getEmail

 

public abstract java.lang.String getEmail( )

 

Returns:
The email address of the logged in user.

 

 

 

getID

 

public abstract java.lang.String getID( )

 

Returns:
The unique ID of the logged in user.

 

 

 

isMemberOfGroup

 

public abstract boolean isMemberOfGroup( java.lang.String groupUniqueID)

 

Determines if the logged in user is a member of the group with the uuid of groupUniqueID

 

Parameters:
groupUniqueID-
The unique id (uuid) of the group
Returns:
Is member of the group?

 

 

 

hasRole

 

public abstract boolean hasRole( java.lang.String roleUniqueID)

 

Determines if the logged in user has the role with the uuid of roleUniqueID

 

Parameters:
roleUniqueID-
The unique id (uuid) of the role to look for
Returns:
Has the role?

 

 

 

doesntHaveRole

 

public abstract boolean doesntHaveRole( java.lang.String roleUniqueID)

 

Opposite of hasRole. Developers: Why do we even have this?

 

Parameters:
roleUniqueID-
The unique id (uuid) of the role to look for
Returns:
Doesn't have the role?

 

 

 

getGroups

 

public abstract java.util.List<GroupScriptType> getGroups( )

 

Gets all the groups the logged in user belongs to

 

Returns:
A list of GroupScriptType objects

 

 

 

getGroupIds

 

@Deprecated
public abstract java.lang.String[] getGroupIds( )

 

Deprecated. Use getGroups() instead

 

Returns:
An array of group uniqueIDs the logged in user belongs to.

 

 

 

getGroupNames

 

@Deprecated
public abstract java.lang.String[] getGroupNames( )

 

Deprecated. Use getGroups() instead

 

Returns:
An array of group names the logged in user belongs to.

 

 

 

getGroupsContainingUser

 

public abstract java.util.List<GroupScriptType> getGroupsContainingUser( java.lang.String userUniqueID)

 

Get a list of groups that the user identified by userUniqueID belongs to. Will do a recursive search of groups. This method has no relation to the logged in user.

 

Parameters:
userUniqueID-
The unique ID of the user.
Returns:
A list of GroupScriptType objects

 

 

 

searchUsers

 

public abstract java.util.List<UserScriptType> searchUsers( java.lang.String query)

 

The user fields the query is matched with is User Management plugin dependent, but generally will attempt to match with username, first name, last name. Wildcards at the start and end of the query are implied. E.g. 'mit' will match 'smith'. This method has no relation to the logged in user.

 

Parameters:
query-
The username, first name or last name to search for
Returns:
A list of UserScriptType objects

 

 

 

getInformationForUsers

 

public abstract java.util.List<UserScriptType> getInformationForUsers( java.lang.String[] userUniqueIDs)

 

Resolve the list of userUniqueIDs into a list of UserScriptType objects. The returned list of users may be shorter than userUniqueIDs if any user ID is not found, and the order of the result list bears no relation to the order of userUniqueIDs. This method has no relation to the logged in user.

 

Parameters:
userUniqueIDs-
An array of user unique IDs
Returns:
A list of UserScriptType objects

 

 

 

getInformationForGroups

 

public abstract java.util.List<GroupScriptType> getInformationForGroups( java.lang.String[] groupUniqueIDs)

 

Resolve the list of groupUniqueIDs into a list of GroupScriptType objects. The returned list of groups may be shorter than groupUniqueIDs if any group ID is not found, and the order of the result list bears no relation to the order of groupUniqueIDs. This method has no relation to the logged in user.

 

Parameters:
groupUniqueIDs-
An array of group unique IDs
Returns:
A list of GroupScriptType objects

 

 

 

searchUsersInGroups

 

public abstract java.util.List<UserScriptType> searchUsersInGroups( java.lang.String query,
java.lang.String groupUniqueID,
boolean recursive)

 

Same as searchUsers(String) but allows to filter the results by a group ID, and whether to search for subgroups of the specified group. Passing null for the groupUniqueID will be the equivalant of using searchUsers(String) Wildcards at the start and end of the query are implied. E.g. 'mit' will match 'smith'. This method has no relation to the logged in user.

 

Parameters:
query-
The username, first name or last name to search for
groupUniqueID-
The group to search within
recursive-
Search within subgroups of the group specified by groupUniqueID
Returns:
A list of UserScriptType objects

 

 

 

searchGroups

 

public abstract java.util.List<GroupScriptType> searchGroups( java.lang.String query)

 

Find all groups with a name matching the query. Wildcards at the start and end of the query are implied. E.g. 'tude' will match 'Students'. This method has no relation to the logged in user.

 

Parameters:
query-
A group name to search for
Returns:
A list of GroupScriptType objects

 

 

 

searchRoles

 

public abstract java.util.List<RoleScriptType> searchRoles( java.lang.String query)

 

Find all roles with a name matching the query. Wildcards at the start and end of the query are implied. E.g. 'strat' will match 'Administrators'. This method has no relation to the logged in user.

 

Parameters:
query-
A role name to search to for
Returns:
A list of RoleScriptType objects