Mobile Data StudioObject Model › Users

The Users class provides access to the User Database, which is a global object.

Note that attempting to access the User Database, even for reading, will fail if it is not enabled (i.e. if using a single shared mobile device password, which is the default configuration). It cannot be enabled or disabled from script.

This can be obtained via the Application.Users property.

Properties

Application

Returns the root Application.

GroupCount

Returns the number of user groups stored in the database as an Integer. See GetNthGroup().

UserCount

Returns the number of users stored in the database as an Integer. See GetNthUser().

Methods

AddGroup

Adds a new user group.

Takes one parameter:

  • name - a String value specifying the name of the new group. There must be no existing group with this name.

AddUser

Adds a new user.

Takes three parameters:

  • unitID - a String value specifying the Unit ID of the new user. There must be no existing user with this Unit ID.
  • password - a String value specifying the password for the new user.
  • enabled - a Boolean value indicating whether the new user should be enabled, or not.

AddProjectToGroup

Adds a project filename to a user group. This project will then be auto-installed to all users who are members of that group.

Takes two parameters:

  • groupName - a String value specifying the name of the group. This group must exist.
  • projectFilename - a String value specifying the project filename.

AddUserToGroup

Makes a user a member of a user group.

Takes two parameters:

  • unitID - a String value specifying the Unit ID of the user. This user must exist.
  • groupName - a String value specifying the name of the group. This group must exist.

DeleteGroup

Deletes a user group.

Takes one parameter:

  • name - a String value specifing the name of the group to delete. This group must exist.

DeleteUser

Deletes a user.

NOTE: This method will not disconnect a currently connected device.

Takes one parameter:

  • unitID - a String value specifing the Unit ID of the user to delete. This user must exist.

DisableUser

Disables a user, so that they cannot log in.

Takes one parameter:

  • unitID - a String value specifying the Unit ID of the user to disable. This user must exist.

EnableUser

Enables a user, so that they can log in.

Takes one parameter:

  • unitID - a String value specifying the Unit ID of the user to enable. This user must exist.

GetGroupProjects

Gets the list of projects that are associated with a user group.

Takes one parameter:

  • name - a String value specifing a group name. This group must exist.

Returns an Array of String values, each one specifying a project filename.

GetGroupUsers

Gets the list of users that are members of a group.

Takes one parameter:

  • name - a String value specifing a group name. This group must exist.

Returns an Array of String values, each one specifying a user's Unit ID.

GetNthGroup

Returns the name of the Nth user group in the database.

Takes one parameter:

  • N - an Integer value specifing which user group to access. In the range 1..GroupCount.

Returns a String with the Nth group name.

GetNthUser

Returns the Unit ID of the Nth user in the database.

Takes one parameter:

  • N - an Integer value specifing which user to access. In the range 1..UserCount.

Returns a String with the Nth user's Unit ID.

GetUserCreated

Gets the time and date when a user record was added.

Takes one parameter:

  • unitID - a String value specifing a Unit ID. This user must exist.

Returns a Date value.

GetUserGroups

Gets the list of groups that a user is a member of.

Takes one parameter:

  • unitID - a String value specifing a Unit ID. This user must exist.

Returns an Array of String values, each one specifying a group name.

GetUserLastSeen

Gets the time and date when a user was last authenticated (logged in).

Takes one parameter:

  • unitID - a String value specifing a Unit ID. This user must exist.

Returns a Date value.

GetUserNote

Returns the "note" field associated with a user. This field is not used by MDS, and can be used by the customer application to associate information with the user record.

Takes one parameter:

  • unitID - a String value specifing a Unit ID. This user must exist.

Returns a String with the user's "note" field.

IsGroup

Tests whether a user group exists with a given group name.

Takes one parameter:

  • name - a String value specifing a group name.

Returns a Boolean value indicating whether the specified group exists, or not.

IsUser

Tests whether a user exists with a given Unit ID.

Takes one parameter:

  • unitID - a String value specifing a Unit ID.

Returns a Boolean value indicating whether the specified user exists, or not.

IsUserEnabled

Tests whether a user is enabled for log in.

Takes one parameter:

  • unitID - a String value specifing a Unit ID. This user must exist.

Returns a Boolean value indicating whether the specified user is enabled, or not.

RemoveProjectFromGroup

Removes a project filename from a user group.

Takes two parameters:

  • groupName - a String value specifying the name of the group. This group must exist.
  • projectFilename - a String value specifying the project filename.

RemoveUserFromGroup

Deletes a group membership, if it exists.

Takes two parameters:

  • unitID - a String value specifying the Unit ID of the user. This user must exist.
  • groupName - a String value specifying the name of the group. This group must exist.

RenameGroup

Rename a user group.

Takes two parameters:

  • oldName - a String value specifing the old name of the group. This group must exist.
  • newName - a String value specifying the new name of the group. This name must not already be in use.

RenameUser

Rename a user.

NOTE: This method will not propagate the rename to a currently connected device.

Takes two parameters:

  • oldUnitID - a String value specifing the old UnitID of the user. This user must exist.
  • newUnitID - a String value specifying the new UnitID of the user. This UnitID must not already be in use.

SetUserNote

Sets the "note" field associated with a user. This field is not used by MDS, and can be used by the customer application to associate information with the user record.

Takes two parameters:

  • unitID - a String value specifing a Unit ID. This user must exist.
  • note - a String value with the user's new "note" field.

SetUserPassword

Change a user's password.

Takes two parameters:

  • unitID - a String value specifing a Unit ID. This user must exist.
  • password - a String value with the user's new password.