Skip to content

Commit 4bc9ddf

Browse files
committed
Merge branch 'addAccessControl' of https://github.com/terminusdb/terminusdb-client-js into addAccessControl
2 parents 32f9e41 + 006f8f9 commit 4bc9ddf

13 files changed

+727
-12
lines changed

RELEASE_NOTES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# TerminusDB Client v10.0.3
2+
3+
## new 🚀
4+
5+
* Added support for new API authentication with TerminusX
6+
7+
## Fixes 🛠
8+
9+
* Fixed optimizeBranch() ([#92](/../../issues/92))
10+
* Fixed encoding URL in client
11+
* Added custom User-Agent header
12+
* Fixed https package not found ([#97](/../../issues/97)) by adding browser setting in package.json
13+
* Fixed replaceAll is not a function error ([#95](/../../issues/95))
14+
15+
---
16+
117
# TerminusDB Client v10.0.2
218

319
## new 🚀

docs/_sidebar.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@
157157
- [commits](api/woqlLibrary.js?id=commits)
158158
- [previousCommits](api/woqlLibrary.js?id=previousCommits)
159159
- [first_commit](api/woqlLibrary.js?id=first_commit)
160+
- [AccessControl](api/accessControl.js?id=AccessControl)
161+
- [getDefaultOrganization](api/accessControl.js?id=getDefaultOrganization)
162+
- [getAPIToken](api/accessControl.js?id=getAPIToken)
163+
- [setAPIToken](api/accessControl.js?id=setAPIToken)
164+
- [getAPIUrl](api/accessControl.js?id=getAPIUrl)
165+
- [getUserRoles](api/accessControl.js?id=getUserRoles)
166+
- [createOrganization](api/accessControl.js?id=createOrganization)
167+
- [ifOrganizationExists](api/accessControl.js?id=ifOrganizationExists)
168+
- [removeUserFromOrg](api/accessControl.js?id=removeUserFromOrg)
169+
- [getPendingOrgInvites](api/accessControl.js?id=getPendingOrgInvites)
170+
- [sendOrgInvite](api/accessControl.js?id=sendOrgInvite)
171+
- [getOrgInvite](api/accessControl.js?id=getOrgInvite)
172+
- [deleteOrgInvite](api/accessControl.js?id=deleteOrgInvite)
173+
- [updateOrgInviteStatus](api/accessControl.js?id=updateOrgInviteStatus)
174+
- [getOrgUsers](api/accessControl.js?id=getOrgUsers)
175+
- [getDatabaseRolesOfUser](api/accessControl.js?id=getDatabaseRolesOfUser)
176+
- [assignUserRole](api/accessControl.js?id=assignUserRole)
177+
- [updateUserRole](api/accessControl.js?id=updateUserRole)
160178
- [TypeDef](api/typedef.js?id=TypeDef)
161179
- [DocParamsGet](api/typedef.js?id=DocParamsGet)
162180
- [DocParamsPost](api/typedef.js?id=DocParamsPost)

docs/api/accessControl.js.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
2+
## AccessControl
3+
#### AccessControl
4+
**License**: Apache Version 2
5+
6+
#### new AccessControl()
7+
The AccessControl object has various methods to control the access for users.
8+
9+
10+
### getDefaultOrganization
11+
#### accessControl.getDefaultOrganization(params) ⇒ <code>string</code> \| <code>undefined</code>
12+
Get a organization from parameters.
13+
14+
**Returns**: <code>string</code> \| <code>undefined</code> - - organization
15+
16+
| Param | Type | Description |
17+
| --- | --- | --- |
18+
| params | <code>object</code> | The parameters |
19+
20+
21+
### getAPIToken
22+
#### accessControl.getAPIToken(params) ⇒ <code>string</code>
23+
Get a API token from parameters.
24+
25+
**Returns**: <code>string</code> - apiToken
26+
27+
| Param | Type | Description |
28+
| --- | --- | --- |
29+
| params | <code>object</code> | The parameters |
30+
31+
32+
### setAPIToken
33+
#### accessControl.setAPIToken(token)
34+
Sets the API token for the object
35+
36+
37+
| Param | Type | Description |
38+
| --- | --- | --- |
39+
| token | <code>string</code> | The api token to use |
40+
41+
42+
### getAPIUrl
43+
#### accessControl.getAPIUrl(cloudAPIUrl) ⇒ <code>string</code>
44+
Get a API url from cloudAPIUrl
45+
46+
**Returns**: <code>string</code> - apiUrl
47+
48+
| Param | Type | Description |
49+
| --- | --- | --- |
50+
| cloudAPIUrl | <code>string</code> | The base url for cloud |
51+
52+
53+
### getUserRoles
54+
#### accessControl.getUserRoles() ⇒ <code>Promise</code>
55+
Get all the system database roles types.
56+
57+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
58+
59+
### createOrganization
60+
#### accessControl.createOrganization(orgName) ⇒ <code>Promise</code>
61+
Any user can create their own organization.
62+
63+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
64+
65+
| Param | Type | Description |
66+
| --- | --- | --- |
67+
| orgName | <code>string</code> | The organization name to create |
68+
69+
70+
### ifOrganizationExists
71+
#### accessControl.ifOrganizationExists(orgName) ⇒ <code>Promise</code>
72+
Check if the organization exists.
73+
74+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
75+
76+
| Param | Type | Description |
77+
| --- | --- | --- |
78+
| orgName | <code>string</code> | The organization name to check if exists. |
79+
80+
81+
### removeUserFromOrg
82+
#### accessControl.removeUserFromOrg(userId, [orgName]) ⇒ <code>Promise</code>
83+
Remove an user from an organization, only an admin user can remove an user from an organization
84+
85+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
86+
87+
| Param | Type | Description |
88+
| --- | --- | --- |
89+
| userId | <code>string</code> | The if of the user to be removed. |
90+
| [orgName] | <code>string</code> | The organization name in which the user is to be removed. |
91+
92+
93+
### getPendingOrgInvites
94+
#### accessControl.getPendingOrgInvites([orgName]) ⇒ <code>Promise</code>
95+
Get the pending invitations list.
96+
97+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
98+
99+
| Param | Type | Description |
100+
| --- | --- | --- |
101+
| [orgName] | <code>string</code> | The organization name. |
102+
103+
104+
### sendOrgInvite
105+
#### accessControl.sendOrgInvite(userEmail, role, [note], [orgName]) ⇒ <code>Promise</code>
106+
Send a new invitation
107+
108+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
109+
110+
| Param | Type | Description |
111+
| --- | --- | --- |
112+
| userEmail | <code>string</code> | The email of user. |
113+
| role | <code>string</code> | The role for user. |
114+
| [note] | <code>string</code> | The note to send with the invitation. |
115+
| [orgName] | <code>string</code> | The organization name. |
116+
117+
118+
### getOrgInvite
119+
#### accessControl.getOrgInvite(inviteId, [orgName]) ⇒ <code>Promise</code>
120+
Get the invitation info
121+
122+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
123+
124+
| Param | Type | Description |
125+
| --- | --- | --- |
126+
| inviteId | <code>string</code> | The invite id to retrieve. |
127+
| [orgName] | <code>string</code> | The organization name. |
128+
129+
130+
### deleteOrgInvite
131+
#### accessControl.deleteOrgInvite(inviteId, [orgName]) ⇒ <code>Promise</code>
132+
Delete an invitation
133+
134+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
135+
136+
| Param | Type | Description |
137+
| --- | --- | --- |
138+
| inviteId | <code>string</code> | The invite id to delete. |
139+
| [orgName] | <code>string</code> | The organization name. |
140+
141+
142+
### updateOrgInviteStatus
143+
#### accessControl.updateOrgInviteStatus(inviteId, accepted, [orgName]) ⇒ <code>Promise</code>
144+
Accept /Reject invitation
145+
146+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
147+
148+
| Param | Type | Description |
149+
| --- | --- | --- |
150+
| inviteId | <code>string</code> | The invite id to updated. |
151+
| accepted | <code>boolean</code> | The status of the invitation. |
152+
| [orgName] | <code>string</code> | The organization name. |
153+
154+
155+
### getOrgUsers
156+
#### accessControl.getOrgUsers([orgName]) ⇒ <code>Promise</code>
157+
Get all the organization's users and roles
158+
159+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
160+
161+
| Param | Type | Description |
162+
| --- | --- | --- |
163+
| [orgName] | <code>string</code> | The organization name. |
164+
165+
166+
### getDatabaseRolesOfUser
167+
#### accessControl.getDatabaseRolesOfUser(userId, [orgName]) ⇒ <code>Promise</code>
168+
Get the user's role for every databases under the organization
169+
170+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
171+
172+
| Param | Type | Description |
173+
| --- | --- | --- |
174+
| userId | <code>string</code> | The user's id. |
175+
| [orgName] | <code>string</code> | The organization name. |
176+
177+
178+
### assignUserRole
179+
#### accessControl.assignUserRole(userId, scope, role, [orgName]) ⇒ <code>Promise</code>
180+
Assign user's a role for a resource (organization/database)
181+
182+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
183+
184+
| Param | Type | Description |
185+
| --- | --- | --- |
186+
| userId | <code>string</code> | The user's id. |
187+
| scope | <code>string</code> | The resource name/id. |
188+
| role | <code>string</code> | The user role to be assigned. |
189+
| [orgName] | <code>string</code> | The organization name. |
190+
191+
192+
### updateUserRole
193+
#### accessControl.updateUserRole(userId, capabilityId, scope, role, [orgName]) ⇒ <code>Promise</code>
194+
Update user's a role for a resource (organization/database)
195+
196+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
197+
198+
| Param | Type | Description |
199+
| --- | --- | --- |
200+
| userId | <code>string</code> | The user's id. |
201+
| capabilityId | <code>string</code> | The capability id. |
202+
| scope | <code>string</code> | The resource name/id. |
203+
| role | <code>string</code> | The user role to be updated. |
204+
| [orgName] | <code>string</code> | The organization name. |
205+

docs/createDocs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const path = require('path')
77
const {woqlClientMenu} = require('./navigationModel')
88

99
/* input and output paths */
10-
const inputFile = ['./lib/woqlClient.js', './lib/woql.js', './lib/query/woqlLibrary.js','./lib/typedef.js']
10+
const inputFile = ['./lib/woqlClient.js', './lib/woql.js', './lib/query/woqlLibrary.js','./lib/accessControl.js','./lib/typedef.js']
1111
const outputDir = './docs/api'
1212

1313
/* create a documentation file for each class */

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ module.exports = {
3131
* @type {typeof import('./lib/axiosInstance')}
3232
*/
3333
axiosInstance: require('./lib/axiosInstance'),
34+
/**
35+
* @type {typeof import('./lib/accessControl')}
36+
*/
37+
AccessControl: require('./lib/accessControl'),
3438
}

0 commit comments

Comments
 (0)