User

Functions for user management

Methods

get_applications(login, context, mode, tagged) → {array}

Get the list of applications authorized to a user.

Get the list of applications authorized to a user. This method can be used in a web interface.
Parameters:
Name Type Argument Default Description
login string <optional>
current user's login Login of the user for which applications are to be retrieved. By default this is the current user.
context string <optional>
web Context in which the application can be user: web, mobile or tablet
mode string <optional>
current execution mode LIVE will return the applications in LIVE version, ACCEPTANCE the applications in both LIVE and ACCEPTANCE versions, TEST will return an empty array. By default this is the current execution mode.
tagged boolean <optional>
false return the `JSONObject` representing the list of user interfaces group by tag if `true`
Returns:
List of applications
Type
array

get_lane_job_number(laneId) → {integer}

Get the expected job number to be done to complete the calculation of the users lane.

This expected job number is equals to zero when the lane is fully up to date.
Parameters:
Name Type Description
laneId integer Lane identifier
Returns:
Number of expected job
Type
integer

get_lane_users(poolId, laneId, pageSize, first) → {array}

Get the list of users pertaining to a lane.

Get the list of users pertaining to a lane (result is paginated) in the current execution mode context.
When called from a LIVE or TEST context, this method will return the list of LIVE users of a lane. When called from an ACCEPTANCE context, this method will return the list of ACCEPTANCE users of a lane.
Parameters:
Name Type Argument Default Description
poolId integer Pool identifier
laneId integer Lane identifier
pageSize integer <optional>
500 Number of users returned
first integer <optional>
0 Index for pagination
Returns:
List of user's descriptors
Type
array

get_lanes(login) → {object}

Get the list of lanes a user pertains to.

Get the list of lanes a user pertains to in the current execution mode context. This method can be used in a web interface.
When called from a LIVE or TEST context, this method will return the list of lanes the user pertains to in LIVE. When called from an ACCEPTANCE context, this method will return the list of lanes the user pertains to in ACCEPTANCE.
Parameters:
Name Type Argument Description
login string <optional>
User login / email. Current user by default
Returns:
Lane descriptor
Type
object

get_manager(login, level) → {string}

Get the user's manager.

Get a manager N levels above the designed user. Only searches within a hierarchy of organizations. Only LIVE configuration of lanes will be considered. Therefore this method's result is independant of the execution mode context.
Parameters:
Name Type Argument Default Description
login string User login / email
level integer <optional>
1 Number of levels of hierarchy
Deprecated:
  • Yes
Throws:
No manager found
Returns:
Login / email of a manager
Type
string

get_preferences(login) → {object}

Get the preferences associated to a user.

Parameters:
Name Type Argument Description
login string <optional>
Login of the user for which the preferences shall be retrieved. By default preferences are retrieved for the current user.
Returns:
User's preferences
Type
object

get_user_data(login) → {object}

Get a user's basic information (id, name, profile) from its login.

Parameters:
Name Type Description
login string User login / email
Returns:
Simplified user descriptor
Type
object

get_user_metadata(login) → {object}

Get the metadata of a user.

Parameters:
Name Type Argument Description
login string <optional>
User login / email. Current user by default
Returns:
Public metadata of the user
Type
object

has_right(login, laneId) → {boolean}

Check if a user belongs to a lane in the current execution mode context.

Check if a user belongs to a lane in the current execution mode context.
When called from a LIVE or TEST context, this method will check the LIVE list of users of the lane. When called from an ACCEPTANCE context, this method will check the ACCEPTANCE list of users of the lane.
Parameters:
Name Type Argument Description
login string <optional>
User login / email. Current user by default
laneId integer Lane identifier
Returns:
`true` if the user belongs to the indicated lane, `false` if the user is not connected or if he/she does not belong to the lane
Type
boolean

impersonate(login) → {string}

Impersonate another user.

Impersonate another user on the same account: only allowed when the process current user is an account's admin
Parameters:
Name Type Description
login string Login / email of the user to impersonate
Throws:
Impersonification is not allowed for user
Returns:
Login of the impersonated user
Type
string

is_user_in_lane(lanes) → {boolean}

Check if the user belongs to at least one lane of the list.

Parameters:
Name Type Description
lanes array List of lane identifiers
Returns:
`true` if the user belongs to at least one lane, `false` otherwise
Type
boolean

P_change_metadata(id, path, input) → {object}

Change a value of the metadata user

Change a specfied value of the user's metadata
Parameters:
Name Type Description
id object login/user_id - Login (email) of the user or its id
path string Path of the value to be changed
input object New value
Throws:
Malformed Object or CastClassException or Expected value
Returns:
- The metadata of the user
Type
object
Example
${P_change_metadata("login@email.com", "mydata.field.2", "my new cool value")}
     // this will change the second item of the item "field" of the item "mydata", its new value will be "my new cool value".
  

P_change_preferences(id, path, input) → {object}

Change a value of the preferences user

Change a specfied value of the user's preferences
Parameters:
Name Type Description
id object login/user_id - Login (email) of the user or its id
path string Path of the value to be changed
input object New value
Throws:
Malformed Object or CastClassException or Expected value
Returns:
- The preferences of the user
Type
object
Example
${P_change_preferences("login@email.com", "mydata.field.2", "my new cool value")} 
     // this will change the second item of the item "field" of the item "mydata", its new value will be "my new cool value".
  

save_preferences(prefs) → {boolean}

Modify the preferences of the current user.

Parameters:
Name Type Description
prefs object New preferences
Returns:
Login of the user
Type
boolean

save_user_metadata(login, metadata) → {boolean}

Modify the metadata of a user.

Parameters:
Name Type Argument Description
login string <optional>
User login / email. Current user by default
metadata object New metadata
Returns:
Login of the user
Type
boolean

unblock_user(login) → {boolean}

Unblock a user.

Change a user's status from blocked to active.
Parameters:
Name Type Description
login string Login / email of the user to unblock
Throws:
Unable to retrieve user
Returns:
Login of the user
Type
boolean