Class User
¶
Represents information about a user account and handles user privileges.
var api = new TVS.Api();
api.login('username', 'password').then(function(loginResponse) {
// email address of the connected user
console.log('email:', loginResponse.User.Email);
// access to archive?
console.log('access to archive?:', loginResponse.User.canAccessArchive());
// specific privilege?
console.log('access to archive privilege?:', loginResponse.User.hasPrivilege(User.PRIVILEGE_ARCHIVE));
});
- class User()¶
Represents a user account and captures meta information about the user including name, email and access privileges. The user class also provides helper methods for querying various privileges, such as access to the archive for example.
Constant Properties
- User.PRIVILEGE_ARCHIVE¶
User access privilege for accessing the archive.
- User.User.PRIVILEGE_DELETE¶
User access privilege for deleting archived documents.
- User.User.PRIVILEGE_ADMIN¶
Highest user access privilege (administrator).
- User.User.PRIVILEGE_SYNC¶
User access privilege for synchronising multiple TrustID Cloud services.
- User.User.PRIVILEGE_AUDITING¶
User access privilege for auditing documents.
- User.User.PRIVILEGE_DATA_EXPORT¶
User access privilege for exporting data.
- User.User.PRIVILEGE_REFERRAL_REVIEWER¶
User access privilege for reviewing application referrals.
- User.User.PRIVILEGE_REFERRAL_MRZ¶
User access privilege for reviewing MRZ-related application referrals.
- User.ARCHIVE_VISIBILITY_USER¶
The user has only access to archived documents that were created by the user.
- User.ARCHIVE_VISIBILITY_BRANCH¶
The user has only access to archived documents that were created by any user of the same branch.
- User.ARCHIVE_VISIBILITY_ORGANISATION¶
The user has only access to archived documents that were created by any user of the same organisation.
- User.ARCHIVE_VISIBILITY_GLOBAL¶
The user has access to all archived documents.
Properties
- User.Id¶
The unique identifier of the user account.
- User.Username¶
The unique username of the user.
- User.Email¶
An optional email address of the user.
- User.Firstname¶
The first name of the user.
- User.Lastname¶
The last name of the user.
- User.Description¶
General description of the user account.
- User.BranchId¶
The unique identifier of the branch this user account belongs to.
- User.BranchName¶
The name of the branch this user belongs to.
- User.Privileges¶
User account privileges encoded as a bit field.
- User.EmailAlertFlags¶
User email alert settings encoded as a bit field.
- User.SetInitialPassword¶
true
if the user account is marked to set the initial password on the next login.
- User.ArchiveVisibility¶
Governs which records the user can view in the archive:
User.ARCHIVE_VISIBILITY_USER
: User can only see records in the archive that they themselves have scanned.User.ARCHIVE_VISIBILITY_BRANCH
: User can see any record in the archive that belongs to their own branch.User.ARCHIVE_VISIBILITY_ORGANISATION
: User can see any record in the archive that belongs to their own organisation including any (other) branch of such organisation.User.ARCHIVE_VISIBILITY_GLOBAL
: User can see any record in the archive irrespective of the document-container’s branch-name.
- User.FailedPasswordAttemptCount¶
Count of failed login attempts since the last successful login.
- User.IsLockedOut¶
true
if the user account is locked after too many failed login attempts.
Methods
- User.hasPrivilege(privilege)¶
Return
true
if the user account has the givenprivilege
.- Arguments
privilege (
int()
) – User account privilege.
- User.canAccessArchive()¶
Return
true
if the user account has access to the archive or is an admin account.
- User.hasArchiveVisibilityUserOnly()¶
Return
true
if the user account can only access its own scanned documents (archive).
- User.hasArchiveVisibilityBranchOnly()¶
Return
true
if the user account can only access documents scanned by its branch (archive).
- User.hasArchiveVisibilityGlobal()¶
Return
true
if the user account can access any scanned document (archive).
- User.hasBranch()¶
Return
true
if the user account belongs to a branch.