License: Apache Version 2
The AccessControl is a driver to work with TerminusDB and TerminusX access control api for the credential you can use the JWT token, the API token or the basic authentication with username and password
Example
accessControl.getDefaultOrganization(params) ⇒ string
| undefined
Get a organization from parameters.
Returns: string
| undefined
- - organization
accessControl.setJwtToken(jwt)
Sets the Jwt token for the object
accessControl.setApiToken(atokenpi)
Sets the API token for the object, to request a token create an account in https://terminusdb.com/
accessControl.setApiKey(atokenpi)
Sets the API token for the object, to request a token create an account in https://terminusdb.com/
accessControl.getAPIUrl(cloudAPIUrl) ⇒ string
Get a API url from cloudAPIUrl
Returns: string
- apiUrl
accessControl.customHeaders(customHeaders) ⇒ object
add extra headers to your request
accessControl.getOrganization(organization) ⇒ object
-- TerminusDB API --- Get an organization from the TerminusDB API.
Returns: object
- - organization
accessControl.getAllOrganizations() ⇒ Promise
-- TerminusDB API --- This end point works in basic authentication, admin user Get list of organizations
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
accessControl.createOrganization(orgName) ⇒ Promise
-- TerminusDB API --- This end point works in basic authentication, admin user Create an organization
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.deleteOrganization(orgName) ⇒ Promise
-- TerminusDB API --- Delete an Organization
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.createRole([name], [actions]) ⇒ Promise
--TerminusDB API --- basic authentication, admin user. Create a new role in the system database.
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.deleteRole([name]) ⇒ Promise
-- TerminusdDB API --- basic Authentication, admin user. Delete role in the system database, (this api is enabled only in the local installation)
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.getAllUsers() ⇒ Promise
-- TerminusdDB API --- basic Authentication, admin user. Return the list of all the users (this api is enabled only in the local installation)
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.createUser(name, [password]) ⇒ Promise
-- TerminusdDB API --- basic Authentication, admin user. Add the user into the system database
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.deleteUser(userId) ⇒ Promise
-- TerminusdDB API --- basic Authentication, admin user. Remove the user from the system database.
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.manageCapability(userName, resourceName, rolesArr, operation, scopeType) ⇒ Promise
-- TerminusdDB API --- Grant/Revoke Capability
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.getAccessRoles() ⇒ Promise
--TerminusX and TerminusDB API --- Get all the system database roles types.
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
accessControl.getOrgUsers([orgName]) ⇒ Promise
-- TerminusX and TerminusDB API -- Get all the organization's users and roles,
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.getTeamUserRoles([userName], [orgName]) ⇒ Promise
-- TerminusX and TerminusDB API -- Get the user roles for a given organization or the default organization,
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.ifOrganizationExists(orgName) ⇒ Promise
-- TerminusX API --- Check if the organization exists. it is a Head call . IMPORTANT This does not work with the API-TOKEN.
Returns: Promise
- A promise that returns the call status object, 200: if the organization exists and 404: if the organization does not exist
accessControl.createOrganizationRemote(orgName) ⇒ Promise
-- TerminusX API --- IMPORTANT This does not work with the API-TOKEN. Create an organization
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.getPendingOrgInvites([orgName]) ⇒ Promise
-- TerminusX API --- Get the pending invitations list.
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.sendOrgInvite(userEmail, role, [note], [orgName]) ⇒ Promise
-- TerminusX API --- Send a new invitation
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.getOrgInvite(inviteId, [orgName]) ⇒ Promise
-- TerminusX API --- Get the invitation info
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.deleteOrgInvite(inviteId, [orgName]) ⇒ Promise
-- TerminusX API --- Delete an invitation
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.updateOrgInviteStatus(inviteId, accepted, [orgName]) ⇒ Promise
-- TerminusX API --- Accept /Reject invitation. if the invitation has been accepted we add the current user to the organization.
the only user that can accept this invitation is the user registered with the invitation email, we indentify the user with the jwt token
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.getTeamUserRole([orgName]) ⇒ Promise
-- TerminusX API --- Get the user role for a given organization or the default organization The user is identified by the jwt or the access token
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.removeUserFromOrg(userId, [orgName]) ⇒ Promise
-- TerminusX API -- Remove an user from an organization, only an admin user can remove an user from an organization
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.getDatabaseRolesOfUser(userId, [orgName]) ⇒ Promise
-- TerminusX API -- Get the user's role for every databases under the organization
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.createUserRole(userId, scope, role, [orgName]) ⇒ Promise
-- TerminusX API -- Create a user's a role for a resource (organization/database)
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.updateUserRole(userId, capabilityId, scope, role, [orgName]) ⇒ Promise
-- TerminusX API -- Update user's a role for a resource (organization/database), (this api works only in terminusX)
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.accessRequestsList([orgName]) ⇒ Promise
-- TerminusX API -- Get all the access request list for a specify organization
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.sendAccessRequest([email], [affiliation], [note], [orgName]) ⇒ Promise
-- TerminusX API -- Get all the access request list for a specify organization
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
accessControl.deleteAccessRequest([orgName]) ⇒ Promise
-- TerminusX API -- Delete an access request to join your team, only an admin user can delete it
Returns: Promise
- A promise that returns the call response object, or an Error if rejected.
Example
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type |
---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
Param | Type | Description |
---|---|---|
params
object
The parameters
jwt
string
The jwt api token to use
atokenpi
string
The API token to use to connect with TerminusX
atokenpi
string
The API token to use to connect with TerminusX
cloudAPIUrl
string
The base url for cloud
customHeaders
object
organization
string
The organization
orgName
string
The organization name to create
orgName
string
The organization name to delete
[name]
string
The role name.
[actions]
typedef.RolesActions
A list of actions
[name]
string
The role name.
name
string
the user name
[password]
string
you need the password for basic authentication
userId
string
the document user id
userName
string
the document user id
resourceName
string
the name of a (database or team)
rolesArr
array
the roles name list
operation
typedef.CapabilityCommand
grant/revoke operation
scopeType
typedef.ScopeType
the resource type (database or organization)
[orgName]
string
The organization name.
[userName]
string
The organization name.
[orgName]
string
The organization name.
orgName
string
The organization name to check if exists.
orgName
string
The organization name to create
[orgName]
string
The organization name.
userEmail
string
The email of user.
role
string
The role for user. (the document @id role like Role/collaborator)
[note]
string
The note to send with the invitation.
[orgName]
string
The organization name.
inviteId
string
The invite id to retrieve.
[orgName]
string
The organization name.
inviteId
string
The invite id to delete.
[orgName]
string
The organization name.
inviteId
string
The invite id to updated.
accepted
boolean
The status of the invitation.
[orgName]
string
The organization name.
[orgName]
string
The organization name.
userId
string
The id of the user to be removed. (this is the document user's @id)
[orgName]
string
The organization name in which the user is to be removed.
userId
string
The user's id.
[orgName]
string
The organization name.
userId
string
The user's id.
scope
string
The resource name/id.
role
string
The user role to be assigned.
[orgName]
string
The organization name.
userId
string
The user's id.
capabilityId
string
The capability id.
scope
string
The resource name/id.
role
string
The user role to be updated.
[orgName]
string
The organization name.
[orgName]
string
The organization name.
[email]
string
the user email.
[affiliation]
string
the user affiliation, company, university etc..
[note]
string
the message for the team admin
[orgName]
string
The organization name.
[orgName]
string
The organization name.