Class: Auth

Auth(opts)

The Auth class wraps auth

Cannot directly be instantiated

Constructor

new Auth(opts)

Creates a Auth

Parameters:
Name Type Description
opts object

The configuration options.

Methods

changeSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Change the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

changeSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Change the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

disable2FA() → {Promise.<any>|Promise.<(*|never)>}

Disable 2FA

Returns:
Type
Promise.<any> | Promise.<(*|never)>

disable2FA() → {Promise.<any>|Promise.<(*|never)>}

Disable 2FA

Returns:
Type
Promise.<any> | Promise.<(*|never)>

generate2FASecret() → {Promise.<*>}

Get the generate2FASecret

Returns:

Return the 2FA secret

Type
Promise.<*>

generate2FASecret() → {Promise.<*>}

Get the generate2FASecret

Returns:

Return the 2FA secret

Type
Promise.<*>

getExtendedSecurity() → {Promise.<*>}

Get extended security mask

Returns:
  • Return integer mask of extended security
Type
Promise.<*>

getExtendedSecurity() → {Promise.<*>}

Get extended security mask

Returns:
  • Return integer mask of extended security
Type
Promise.<*>

getGrantedRoles(uuid) → {Promise.<*>}

Get granted roles

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted roles
Type
Promise.<*>

getGrantedRoles(uuid) → {Promise.<*>}

Get granted roles

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted roles
Type
Promise.<*>

getGrantedUsers(uuid) → {Promise.<*>}

Get granted users

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted users
Type
Promise.<*>

getGrantedUsers(uuid) → {Promise.<*>}

Get granted users

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted users
Type
Promise.<*>

getHasSecurityRecursive(userId) → {Promise.<*>}

Check if user is a security recursive

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a security recursive otherwise false
Type
Promise.<*>

getHasSecurityRecursive(userId) → {Promise.<*>}

Check if user is a security recursive

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a security recursive otherwise false
Type
Promise.<*>

getHasVersionAdmin(userId) → {Promise.<*>}

Check if user has role version admin

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a version admin otherwise false
Type
Promise.<*>

getHasVersionAdmin(userId) → {Promise.<*>}

Check if user has role version admin

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a version admin otherwise false
Type
Promise.<*>

getIsAdmin(userId) → {Promise.<*>}

Check if user is a super user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a superuser otherwise false
Type
Promise.<*>

getIsAdmin(userId) → {Promise.<*>}

Check if user is a super user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a superuser otherwise false
Type
Promise.<*>

getIsLoginLowerCase() → {Promise.<*>}

Get the getIsLoginLowerCase

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

getIsLoginLowerCase() → {Promise.<*>}

Get the getIsLoginLowerCase

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

getIsPasswordExpired() → {Promise.<*>}

Check if the password of the logged user is expired

Returns:

Return true when the password of the user is expired

Type
Promise.<*>

getIsPasswordExpired() → {Promise.<*>}

Check if the password of the logged user is expired

Returns:

Return true when the password of the user is expired

Type
Promise.<*>

getIsTwoFactorAuthentication() → {Promise.<*>}

Get the getIsTwoFactorAuthentication

Returns:

Return true when two factor authentication configuration is enabled

Type
Promise.<*>

getIsTwoFactorAuthentication() → {Promise.<*>}

Get the getIsTwoFactorAuthentication

Returns:

Return true when two factor authentication configuration is enabled

Type
Promise.<*>

getIsUserPasswordReset() → {Promise.<*>}

Get the getIsUserPasswordReset

Returns:

Return true when user password reset is enabled

Type
Promise.<*>

getIsUserPasswordReset() → {Promise.<*>}

Get the getIsUserPasswordReset

Returns:

Return true when user password reset is enabled

Type
Promise.<*>

getLiveEditToken() → {Promise.<*>}

Get the getLiveEditToken

Returns:

Return the live edit token ( it is a login token with a list of empty roles )

Type
Promise.<*>

getLiveEditToken() → {Promise.<*>}

Get the getLiveEditToken

Returns:

Return the live edit token ( it is a login token with a list of empty roles )

Type
Promise.<*>

getRoles(showAll) → {Promise.<*>}

Get roles

Parameters:
Name Type Description
showAll

When true show all the roles ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current roles
Type
Promise.<*>

getRoles(showAll) → {Promise.<*>}

Get roles

Parameters:
Name Type Description
showAll

When true show all the roles ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current roles
Type
Promise.<*>

getSessionId() → {Promise.<*>}

Get the getSessionId

Returns:

Return the getSessionId

Type
Promise.<*>

getSessionId() → {Promise.<*>}

Get the getSessionId

Returns:

Return the getSessionId

Type
Promise.<*>

getTwoFactorQR(secret) → {Promise.<*>}

Get the 2FA QR

Parameters:
Name Type Description
secret

The 2FA secret

Returns:
  • Return void
Type
Promise.<*>

getTwoFactorQR(secret) → {Promise.<*>}

Get the 2FA QR

Parameters:
Name Type Description
secret

The 2FA secret

Returns:
  • Return void
Type
Promise.<*>

getUser(usrId) → {Promise.<*>}

Get user

Parameters:
Name Type Description
usrId

The id of the user

Returns:
  • Return the current username
Type
Promise.<*>

getUser(usrId) → {Promise.<*>}

Get user

Parameters:
Name Type Description
usrId

The id of the user

Returns:
  • Return the current username
Type
Promise.<*>

getUserProfile(userId) → {Promise.<*>}

Get the profile of the user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return the user profile assigned to the user
Type
Promise.<*>

getUserProfile(userId) → {Promise.<*>}

Get the profile of the user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return the user profile assigned to the user
Type
Promise.<*>

getUsers(showAll) → {Promise.<*>}

Get users

Parameters:
Name Type Description
showAll

When true show all the users ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current users
Type
Promise.<*>

getUsers(showAll) → {Promise.<*>}

Get users

Parameters:
Name Type Description
showAll

When true show all the users ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current users
Type
Promise.<*>

getUsersByRole(roleId) → {Promise.<*>}

Get users by role

Parameters:
Name Type Description
roleId

The role id

Returns:
  • Return the list of current users
Type
Promise.<*>

getUsersByRole(roleId) → {Promise.<*>}

Get users by role

Parameters:
Name Type Description
roleId

The role id

Returns:
  • Return the list of current users
Type
Promise.<*>

getUserTenants() → {Promise.<*>}

Get the getUserTenants

Returns:

Return the getSessionId

Type
Promise.<*>

getUserTenants() → {Promise.<*>}

Get the getUserTenants

Returns:

Return the getSessionId

Type
Promise.<*>

login(username, password) → {Promise.<*>}

Login into OpenKM

Parameters:
Name Type Description
username

The username

password

The password

Returns:
  • A promise string with the token
Type
Promise.<*>

login(username, password) → {Promise.<*>}

Login into OpenKM

Parameters:
Name Type Description
username

The username

password

The password

Returns:
  • A promise string with the token
Type
Promise.<*>

logout() → {Promise.<*>}

Logout from OpenKM

Returns:
Type
Promise.<*>

logout() → {Promise.<*>}

Logout from OpenKM

Returns:
Type
Promise.<*>

overwriteSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Overwrite the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

overwriteSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Overwrite the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

refreshToken() → {Promise.<*>}

Get the refreshToken

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

refreshToken() → {Promise.<*>}

Get the refreshToken

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

resetPassword(The) → {Promise.<any>|Promise.<(*|never)>}

Reset the password of the user

Parameters:
Name Type Description
The

userId

Returns:
Type
Promise.<any> | Promise.<(*|never)>

resetPassword(The) → {Promise.<any>|Promise.<(*|never)>}

Reset the password of the user

Parameters:
Name Type Description
The

userId

Returns:
Type
Promise.<any> | Promise.<(*|never)>

setRestUrl(restUrl)

Set the rest url

Parameters:
Name Type Description
restUrl

The rest url

setRestUrl(restUrl)

Set the rest url

Parameters:
Name Type Description
restUrl

The rest url

setToken(token)

Set the token in Auth variables

Parameters:
Name Type Description
token

The authorization token value

setToken(token)

Set the token in Auth variables

Parameters:
Name Type Description
token

The authorization token value

setUserTenant(tenantId) → {Promise.<*>}

Update tenant

Parameters:
Name Type Description
tenantId

The id of the tenant

Returns:
Type
Promise.<*>

setUserTenant(tenantId) → {Promise.<*>}

Update tenant

Parameters:
Name Type Description
tenantId

The id of the tenant

Returns:
Type
Promise.<*>

updateUser(userId, password, name, active) → {Promise.<*>}

Update user

Parameters:
Name Type Description
userId

The id of the user

password

The user password

name

The user name

active

When true the user is active

Returns:
Type
Promise.<*>

updateUser(userId, password, name, active) → {Promise.<*>}

Update user

Parameters:
Name Type Description
userId

The id of the user

password

The user password

name

The user name

active

When true the user is active

Returns:
Type
Promise.<*>

validate2FAAndSaveSecret(secret, code) → {Promise.<any>|Promise.<(*|never)>}

Validate 2FA code and save secret

Parameters:
Name Type Description
secret

The 2FA secret

code

The 2FA code

Returns:
Type
Promise.<any> | Promise.<(*|never)>

validate2FAAndSaveSecret(secret, code) → {Promise.<any>|Promise.<(*|never)>}

Validate 2FA code and save secret

Parameters:
Name Type Description
secret

The 2FA secret

code

The 2FA code

Returns:
Type
Promise.<any> | Promise.<(*|never)>

verify2FACode(code) → {Promise.<*>}

Verify the 2FA

Parameters:
Name Type Description
code

The 2FA code

Returns:
  • Return true when code is valid
Type
Promise.<*>

verify2FACode(code) → {Promise.<*>}

Verify the 2FA

Parameters:
Name Type Description
code

The 2FA code

Returns:
  • Return true when code is valid
Type
Promise.<*>

Auth(opts)

The Auth class wraps auth

Cannot directly be instantiated

Constructor

new Auth(opts)

Creates a Auth

Parameters:
Name Type Description
opts object

The configuration options.

Methods

changeSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Change the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

changeSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Change the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

disable2FA() → {Promise.<any>|Promise.<(*|never)>}

Disable 2FA

Returns:
Type
Promise.<any> | Promise.<(*|never)>

disable2FA() → {Promise.<any>|Promise.<(*|never)>}

Disable 2FA

Returns:
Type
Promise.<any> | Promise.<(*|never)>

generate2FASecret() → {Promise.<*>}

Get the generate2FASecret

Returns:

Return the 2FA secret

Type
Promise.<*>

generate2FASecret() → {Promise.<*>}

Get the generate2FASecret

Returns:

Return the 2FA secret

Type
Promise.<*>

getExtendedSecurity() → {Promise.<*>}

Get extended security mask

Returns:
  • Return integer mask of extended security
Type
Promise.<*>

getExtendedSecurity() → {Promise.<*>}

Get extended security mask

Returns:
  • Return integer mask of extended security
Type
Promise.<*>

getGrantedRoles(uuid) → {Promise.<*>}

Get granted roles

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted roles
Type
Promise.<*>

getGrantedRoles(uuid) → {Promise.<*>}

Get granted roles

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted roles
Type
Promise.<*>

getGrantedUsers(uuid) → {Promise.<*>}

Get granted users

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted users
Type
Promise.<*>

getGrantedUsers(uuid) → {Promise.<*>}

Get granted users

Parameters:
Name Type Description
uuid

The uuid of the node

Returns:
  • Return a list of granted users
Type
Promise.<*>

getHasSecurityRecursive(userId) → {Promise.<*>}

Check if user is a security recursive

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a security recursive otherwise false
Type
Promise.<*>

getHasSecurityRecursive(userId) → {Promise.<*>}

Check if user is a security recursive

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a security recursive otherwise false
Type
Promise.<*>

getHasVersionAdmin(userId) → {Promise.<*>}

Check if user has role version admin

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a version admin otherwise false
Type
Promise.<*>

getHasVersionAdmin(userId) → {Promise.<*>}

Check if user has role version admin

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a version admin otherwise false
Type
Promise.<*>

getIsAdmin(userId) → {Promise.<*>}

Check if user is a super user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a superuser otherwise false
Type
Promise.<*>

getIsAdmin(userId) → {Promise.<*>}

Check if user is a super user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return true when user is a superuser otherwise false
Type
Promise.<*>

getIsLoginLowerCase() → {Promise.<*>}

Get the getIsLoginLowerCase

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

getIsLoginLowerCase() → {Promise.<*>}

Get the getIsLoginLowerCase

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

getIsPasswordExpired() → {Promise.<*>}

Check if the password of the logged user is expired

Returns:

Return true when the password of the user is expired

Type
Promise.<*>

getIsPasswordExpired() → {Promise.<*>}

Check if the password of the logged user is expired

Returns:

Return true when the password of the user is expired

Type
Promise.<*>

getIsTwoFactorAuthentication() → {Promise.<*>}

Get the getIsTwoFactorAuthentication

Returns:

Return true when two factor authentication configuration is enabled

Type
Promise.<*>

getIsTwoFactorAuthentication() → {Promise.<*>}

Get the getIsTwoFactorAuthentication

Returns:

Return true when two factor authentication configuration is enabled

Type
Promise.<*>

getIsUserPasswordReset() → {Promise.<*>}

Get the getIsUserPasswordReset

Returns:

Return true when user password reset is enabled

Type
Promise.<*>

getIsUserPasswordReset() → {Promise.<*>}

Get the getIsUserPasswordReset

Returns:

Return true when user password reset is enabled

Type
Promise.<*>

getLiveEditToken() → {Promise.<*>}

Get the getLiveEditToken

Returns:

Return the live edit token ( it is a login token with a list of empty roles )

Type
Promise.<*>

getLiveEditToken() → {Promise.<*>}

Get the getLiveEditToken

Returns:

Return the live edit token ( it is a login token with a list of empty roles )

Type
Promise.<*>

getRoles(showAll) → {Promise.<*>}

Get roles

Parameters:
Name Type Description
showAll

When true show all the roles ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current roles
Type
Promise.<*>

getRoles(showAll) → {Promise.<*>}

Get roles

Parameters:
Name Type Description
showAll

When true show all the roles ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current roles
Type
Promise.<*>

getSessionId() → {Promise.<*>}

Get the getSessionId

Returns:

Return the getSessionId

Type
Promise.<*>

getSessionId() → {Promise.<*>}

Get the getSessionId

Returns:

Return the getSessionId

Type
Promise.<*>

getTwoFactorQR(secret) → {Promise.<*>}

Get the 2FA QR

Parameters:
Name Type Description
secret

The 2FA secret

Returns:
  • Return void
Type
Promise.<*>

getTwoFactorQR(secret) → {Promise.<*>}

Get the 2FA QR

Parameters:
Name Type Description
secret

The 2FA secret

Returns:
  • Return void
Type
Promise.<*>

getUser(usrId) → {Promise.<*>}

Get user

Parameters:
Name Type Description
usrId

The id of the user

Returns:
  • Return the current username
Type
Promise.<*>

getUser(usrId) → {Promise.<*>}

Get user

Parameters:
Name Type Description
usrId

The id of the user

Returns:
  • Return the current username
Type
Promise.<*>

getUserProfile(userId) → {Promise.<*>}

Get the profile of the user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return the user profile assigned to the user
Type
Promise.<*>

getUserProfile(userId) → {Promise.<*>}

Get the profile of the user

Parameters:
Name Type Description
userId

The username

Returns:
  • Return the user profile assigned to the user
Type
Promise.<*>

getUsers(showAll) → {Promise.<*>}

Get users

Parameters:
Name Type Description
showAll

When true show all the users ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current users
Type
Promise.<*>

getUsers(showAll) → {Promise.<*>}

Get users

Parameters:
Name Type Description
showAll

When true show all the users ( enabled and disabled ) otherwise return enabled

Returns:
  • Return the list of current users
Type
Promise.<*>

getUsersByRole(roleId) → {Promise.<*>}

Get users by role

Parameters:
Name Type Description
roleId

The role id

Returns:
  • Return the list of current users
Type
Promise.<*>

getUsersByRole(roleId) → {Promise.<*>}

Get users by role

Parameters:
Name Type Description
roleId

The role id

Returns:
  • Return the list of current users
Type
Promise.<*>

getUserTenants() → {Promise.<*>}

Get the getUserTenants

Returns:

Return the getSessionId

Type
Promise.<*>

getUserTenants() → {Promise.<*>}

Get the getUserTenants

Returns:

Return the getSessionId

Type
Promise.<*>

login(username, password) → {Promise.<*>}

Login into OpenKM

Parameters:
Name Type Description
username

The username

password

The password

Returns:
  • A promise string with the token
Type
Promise.<*>

login(username, password) → {Promise.<*>}

Login into OpenKM

Parameters:
Name Type Description
username

The username

password

The password

Returns:
  • A promise string with the token
Type
Promise.<*>

logout() → {Promise.<*>}

Logout from OpenKM

Returns:
Type
Promise.<*>

logout() → {Promise.<*>}

Logout from OpenKM

Returns:
Type
Promise.<*>

overwriteSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Overwrite the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

overwriteSecurity(uuid, changeSecurity) → {Promise.<any>|Promise.<(*|never)>}

Overwrite the security of a node

Parameters:
Name Type Description
uuid

The uuid of the node

changeSecurity

The object what contains the security changes

Returns:
Type
Promise.<any> | Promise.<(*|never)>

refreshToken() → {Promise.<*>}

Get the refreshToken

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

refreshToken() → {Promise.<*>}

Get the refreshToken

Returns:

Return true when login is forced to lowercase

Type
Promise.<*>

resetPassword(The) → {Promise.<any>|Promise.<(*|never)>}

Reset the password of the user

Parameters:
Name Type Description
The

userId

Returns:
Type
Promise.<any> | Promise.<(*|never)>

resetPassword(The) → {Promise.<any>|Promise.<(*|never)>}

Reset the password of the user

Parameters:
Name Type Description
The

userId

Returns:
Type
Promise.<any> | Promise.<(*|never)>

setRestUrl(restUrl)

Set the rest url

Parameters:
Name Type Description
restUrl

The rest url

setRestUrl(restUrl)

Set the rest url

Parameters:
Name Type Description
restUrl

The rest url

setToken(token)

Set the token in Auth variables

Parameters:
Name Type Description
token

The authorization token value

setToken(token)

Set the token in Auth variables

Parameters:
Name Type Description
token

The authorization token value

setUserTenant(tenantId) → {Promise.<*>}

Update tenant

Parameters:
Name Type Description
tenantId

The id of the tenant

Returns:
Type
Promise.<*>

setUserTenant(tenantId) → {Promise.<*>}

Update tenant

Parameters:
Name Type Description
tenantId

The id of the tenant

Returns:
Type
Promise.<*>

updateUser(userId, password, name, active) → {Promise.<*>}

Update user

Parameters:
Name Type Description
userId

The id of the user

password

The user password

name

The user name

active

When true the user is active

Returns:
Type
Promise.<*>

updateUser(userId, password, name, active) → {Promise.<*>}

Update user

Parameters:
Name Type Description
userId

The id of the user

password

The user password

name

The user name

active

When true the user is active

Returns:
Type
Promise.<*>

validate2FAAndSaveSecret(secret, code) → {Promise.<any>|Promise.<(*|never)>}

Validate 2FA code and save secret

Parameters:
Name Type Description
secret

The 2FA secret

code

The 2FA code

Returns:
Type
Promise.<any> | Promise.<(*|never)>

validate2FAAndSaveSecret(secret, code) → {Promise.<any>|Promise.<(*|never)>}

Validate 2FA code and save secret

Parameters:
Name Type Description
secret

The 2FA secret

code

The 2FA code

Returns:
Type
Promise.<any> | Promise.<(*|never)>

verify2FACode(code) → {Promise.<*>}

Verify the 2FA

Parameters:
Name Type Description
code

The 2FA code

Returns:
  • Return true when code is valid
Type
Promise.<*>

verify2FACode(code) → {Promise.<*>}

Verify the 2FA

Parameters:
Name Type Description
code

The 2FA code

Returns:
  • Return true when code is valid
Type
Promise.<*>