Skip to content

Commit e541dc7

Browse files
committed
Update docs with recent changes
* Run `npm run mkdocs` * These are due to changes in `docs/createDocs.js`.
1 parent 53c088a commit e541dc7

File tree

6 files changed

+583
-485
lines changed

6 files changed

+583
-485
lines changed

docs/_sidebar.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
- [generateCommitInfo](api/woqlClient.js?id=generateCommitInfo)
4747
- [generateCommitDescriptor](api/woqlClient.js?id=generateCommitDescriptor)
4848
- [prepareRevisionControlArgs](api/woqlClient.js?id=prepareRevisionControlArgs)
49-
- [getDatabase](api/woqlClient.js?id=getDatabase)
5049
- [updateDatabase](api/woqlClient.js?id=updateDatabase)
5150
- [addDocument](api/woqlClient.js?id=addDocument)
5251
- [queryDocument](api/woqlClient.js?id=queryDocument)
@@ -179,6 +178,9 @@
179178
- [getDatabaseRolesOfUser](api/accessControl.js?id=getDatabaseRolesOfUser)
180179
- [createUserRole](api/accessControl.js?id=createUserRole)
181180
- [updateUserRole](api/accessControl.js?id=updateUserRole)
181+
- [accessRequestsList](api/accessControl.js?id=accessRequestsList)
182+
- [sendAccessRequest](api/accessControl.js?id=sendAccessRequest)
183+
- [deleteAccessRequest](api/accessControl.js?id=deleteAccessRequest)
182184
- [TypeDef](api/typedef.js?id=TypeDef)
183185
- [DocParamsGet](api/typedef.js?id=DocParamsGet)
184186
- [DocParamsPost](api/typedef.js?id=DocParamsPost)

docs/api/accessControl.js.md

Lines changed: 121 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

2+
# AccessControl
23
## AccessControl
3-
#### AccessControl
44
**License**: Apache Version 2
55

6-
#### new AccessControl()
6+
## new AccessControl()
77
The AccessControl object has various methods to control the access for users.
88
for the credential you can use the JWT token or the API token
99

1010
**Example**
1111
```js
12-
//connect with the API token
12+
//connect with the API token
1313
//(to request a token create an account in https://terminusdb.com/)
1414
const accessContol = new AccessControl("https://servername.com",
1515
{organization:"my_team_name",
@@ -18,7 +18,7 @@ accessControl.getOrgUsers().then(result=>{
1818
console.log(result)
1919
})
2020

21-
//connect with the jwt token this type of connection is only for the dashboard
21+
//connect with the jwt token this type of connection is only for the dashboard
2222
//or for application integrate with our login workflow
2323
const accessContol = new AccessControl("https://servername.com",
2424
{organization:"my_team_name",
@@ -28,11 +28,12 @@ accessControl.getOrgUsers().then(result=>{
2828
})
2929

3030
//if the jwt is expired you can change it with
31-
accessControl.setJwtToken("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYyeTFORUd.......")
31+
accessControl.setJwtToken("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkpXUjBIOXYy
32+
eTFORUd.......")
3233
```
3334

34-
### getDefaultOrganization
35-
#### accessControl.getDefaultOrganization(params) ⇒ <code>string</code> \| <code>undefined</code>
35+
## getDefaultOrganization
36+
##### accessControl.getDefaultOrganization(params) ⇒ <code>string</code> \| <code>undefined</code>
3637
Get a organization from parameters.
3738

3839
**Returns**: <code>string</code> \| <code>undefined</code> - - organization
@@ -42,8 +43,8 @@ Get a organization from parameters.
4243
| params | <code>object</code> | The parameters |
4344

4445

45-
### setJwtToken
46-
#### accessControl.setJwtToken(jwt)
46+
## setJwtToken
47+
##### accessControl.setJwtToken(jwt)
4748
Sets the Jwt token for the object
4849

4950

@@ -52,8 +53,8 @@ Sets the Jwt token for the object
5253
| jwt | <code>string</code> | The jwt api token to use |
5354

5455

55-
### setApiToken
56-
#### accessControl.setApiToken(atokenpi)
56+
## setApiToken
57+
##### accessControl.setApiToken(atokenpi)
5758
Sets the API token for the object, to request a token create an account in https://terminusdb.com/
5859

5960

@@ -62,8 +63,8 @@ Sets the API token for the object, to request a token create an account in http
6263
| atokenpi | <code>string</code> | The API token to use to connect with TerminusX |
6364

6465

65-
### getAPIUrl
66-
#### accessControl.getAPIUrl(cloudAPIUrl) ⇒ <code>string</code>
66+
## getAPIUrl
67+
##### accessControl.getAPIUrl(cloudAPIUrl) ⇒ <code>string</code>
6768
Get a API url from cloudAPIUrl
6869

6970
**Returns**: <code>string</code> - apiUrl
@@ -73,14 +74,14 @@ Get a API url from cloudAPIUrl
7374
| cloudAPIUrl | <code>string</code> | The base url for cloud |
7475

7576

76-
### getAccessRoles
77-
#### accessControl.getAccessRoles() ⇒ <code>Promise</code>
77+
## getAccessRoles
78+
##### accessControl.getAccessRoles() ⇒ <code>Promise</code>
7879
Get all the system database roles types.
7980

8081
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
8182

82-
### createOrganization
83-
#### accessControl.createOrganization(orgName) ⇒ <code>Promise</code>
83+
## createOrganization
84+
##### accessControl.createOrganization(orgName) ⇒ <code>Promise</code>
8485
Any user can create their own organization.
8586
IMPORTANT This does not work with the API-TOKEN.
8687

@@ -97,20 +98,21 @@ accessControl.createOrganization("my_org_name").then(result=>{
9798
})
9899
```
99100

100-
### ifOrganizationExists
101-
#### accessControl.ifOrganizationExists(orgName) ⇒ <code>Promise</code>
101+
## ifOrganizationExists
102+
##### accessControl.ifOrganizationExists(orgName) ⇒ <code>Promise</code>
102103
Check if the organization exists. it is a Head call .
103104
IMPORTANT This does not work with the API-TOKEN.
104105

105-
**Returns**: <code>Promise</code> - A promise that returns the call status object, 200: if the organization exists and 404: if the organization does not exist
106+
**Returns**: <code>Promise</code> - A promise that returns the call status object, 200: if the organization
107+
exists and 404: if the organization does not exist
106108

107109
| Param | Type | Description |
108110
| --- | --- | --- |
109111
| orgName | <code>string</code> | The organization name to check if exists. |
110112

111113

112-
### getPendingOrgInvites
113-
#### accessControl.getPendingOrgInvites([orgName]) ⇒ <code>Promise</code>
114+
## getPendingOrgInvites
115+
##### accessControl.getPendingOrgInvites([orgName]) ⇒ <code>Promise</code>
114116
Get the pending invitations list.
115117

116118
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -126,7 +128,8 @@ const invitationList = accessControl.getPendingOrgInvites().then(result=>{
126128

127129
})
128130
//this will return an array of invitations object like this
129-
//[{@id: "Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
131+
//[{@id: "Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc2ac51161ef5ba
132+
cb0988d992c4bce82b3fa5d25"
130133
// @type: "Invitation"
131134
// creation_date: "2021-10-22T11:13:28.762Z"
132135
// email_to: "new_user@terminusdb.com"
@@ -135,8 +138,8 @@ const invitationList = accessControl.getPendingOrgInvites().then(result=>{
135138
// status: "needs_invite"}]
136139
```
137140
138-
### sendOrgInvite
139-
#### accessControl.sendOrgInvite(userEmail, role, [note], [orgName]) ⇒ <code>Promise</code>
141+
## sendOrgInvite
142+
##### accessControl.sendOrgInvite(userEmail, role, [note], [orgName]) ⇒ <code>Promise</code>
140143
Send a new invitation
141144
142145
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -150,13 +153,14 @@ Send a new invitation
150153
151154
**Example**
152155
```js
153-
accessControl.sendOrgInvite("[email protected]","Role/admin","please join my team").then(result=>{
156+
accessControl.sendOrgInvite("new_user@terminusdb.com","Role/admin",
157+
"please join myteam").then(result=>{
154158
console.log(result)
155159
})
156160
```
157161
158-
### getOrgInvite
159-
#### accessControl.getOrgInvite(inviteId, [orgName]) ⇒ <code>Promise</code>
162+
## getOrgInvite
163+
##### accessControl.getOrgInvite(inviteId, [orgName]) ⇒ <code>Promise</code>
160164
Get the invitation info
161165
162166
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -168,14 +172,15 @@ Get the invitation info
168172
169173
**Example**
170174
```js
171-
const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
175+
const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc
176+
2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
172177
accessControl.getOrgInvite(fullInviteId).then(result=>{
173178
console.log(result)
174179
})
175180
```
176181
177-
### deleteOrgInvite
178-
#### accessControl.deleteOrgInvite(inviteId, [orgName]) ⇒ <code>Promise</code>
182+
## deleteOrgInvite
183+
##### accessControl.deleteOrgInvite(inviteId, [orgName]) ⇒ <code>Promise</code>
179184
Delete an invitation
180185
181186
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -187,17 +192,19 @@ Delete an invitation
187192
188193
**Example**
189194
```js
190-
const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
195+
const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9
196+
c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
191197
accessControl.deleteOrgInvite(fullInviteId).then(result=>{
192198
console.log(result)
193199
})
194200
```
195201
196-
### updateOrgInviteStatus
197-
#### accessControl.updateOrgInviteStatus(inviteId, accepted, [orgName]) ⇒ <code>Promise</code>
198-
Accept /Reject invitation. if the invitation has been accepted we add the current user to the organization.
202+
## updateOrgInviteStatus
203+
##### accessControl.updateOrgInviteStatus(inviteId, accepted, [orgName]) ⇒ <code>Promise</code>
204+
Accept /Reject invitation. if the invitation has been accepted we add the current user
205+
to the organization.
199206
200-
the only user that can accept this invitation is the user registered with the invitation email,
207+
the only user that can accept this invitation is the user registered with the invitation email,
201208
we indentify the user with the jwt token
202209
203210
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -210,14 +217,15 @@ we indentify the user with the jwt token
210217
211218
**Example**
212219
```js
213-
const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
220+
const fullInviteId="Organization/my_team_name/invitations/Invitation/7ad0c9eb82b6175bcda9
221+
c0dfc2ac51161ef5ba7cb0988d992c4bce82b3fa5d25"
214222
accessControl.updateOrgInviteStatus(fullInviteId,true).then(result=>{
215223
console.log(result)
216224
})
217225
```
218226
219-
### getOrgUsers
220-
#### accessControl.getOrgUsers([orgName]) ⇒ <code>Promise</code>
227+
## getOrgUsers
228+
##### accessControl.getOrgUsers([orgName]) ⇒ <code>Promise</code>
221229
Get all the organization's users and roles
222230
223231
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -241,8 +249,8 @@ accessControl.getOrgUsers().then(result=>{
241249
// user: "User/auth0%7C613f5dnndjdjkTTT"}]
242250
```
243251
244-
### removeUserFromOrg
245-
#### accessControl.removeUserFromOrg(userId, [orgName]) ⇒ <code>Promise</code>
252+
## removeUserFromOrg
253+
##### accessControl.removeUserFromOrg(userId, [orgName]) ⇒ <code>Promise</code>
246254
Remove an user from an organization, only an admin user can remove an user from an organization
247255
248256
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -259,8 +267,8 @@ accessControl.removeUserFromOrg("User/auth0%7C613f5dnndjdjkTTT","my_org_name").t
259267
})
260268
```
261269
262-
### getDatabaseRolesOfUser
263-
#### accessControl.getDatabaseRolesOfUser(userId, [orgName]) ⇒ <code>Promise</code>
270+
## getDatabaseRolesOfUser
271+
##### accessControl.getDatabaseRolesOfUser(userId, [orgName]) ⇒ <code>Promise</code>
264272
Get the user's role for every databases under the organization
265273
266274
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -277,23 +285,24 @@ accessControl.getDatabaseRolesOfUser('User/auth0%7C61790e366377Yu6596a').then(re
277285
})
278286
279287
//this is a capabilities list of databases and roles
280-
//[ {capability: "Capability/b395e8523d509dec6b33aefc9baed3b2e2bfadbd4c79d4ff9b20dce2b14e2edc"
288+
//[ {capability: "Capability/b395e8523d509dec6b33aefc9baed3b2e2bfadbd4c79d4ff9b20dce2b14e2edc"
281289
//if there is an id we have a user specific capabality for this database
282290
// name: {@type: "xsd:string", @value: "profiles_test"}
283291
// role: "Role/dataUpdater"
284292
// scope: "UserDatabase/7ebdfae5a02bc7e8f6d79sjjjsa4e179b1df9d4576a3b1d2e5ff3b4859"
285293
// user: "User/auth0%7C61790e11a3966d006906596a"},
286294
287-
//{ capability: null
288-
// if the capability id is null the user level of access for this database is the same of the team
295+
//{ capability: null
296+
// if the capability id is null the user level of access for this database is the
297+
same of the team
289298
//name: {@type: "xsd:string", @value: "Collab002"}
290299
//role: "Role/dataReader"
291300
// scope: "UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f"
292-
//user: "User/auth0%7C61790e11a3966d006906596a"}]
301+
//user: "User/auth0%7C61790e11a3966d006906596a"}]
293302
```
294303
295-
### createUserRole
296-
#### accessControl.createUserRole(userId, scope, role, [orgName]) ⇒ <code>Promise</code>
304+
## createUserRole
305+
##### accessControl.createUserRole(userId, scope, role, [orgName]) ⇒ <code>Promise</code>
297306
Create a user's a role for a resource (organization/database)
298307
299308
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -308,14 +317,15 @@ Create a user's a role for a resource (organization/database)
308317
**Example**
309318
```js
310319
const dbId = "UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f"
311-
accessControl.assignUserRole('User/auth0%7C61790e11a3966d006906596a',dbId,"Role/collaborator").then(result=>{
320+
accessControl.assignUserRole('User/auth0%7C61790e11a3966d006906596a',dbId,
321+
"Role/collaborator").then(result=>{
312322
console.log(result)
313323
314324
})
315325
```
316326
317-
### updateUserRole
318-
#### accessControl.updateUserRole(userId, capabilityId, scope, role, [orgName]) ⇒ <code>Promise</code>
327+
## updateUserRole
328+
##### accessControl.updateUserRole(userId, capabilityId, scope, role, [orgName]) ⇒ <code>Promise</code>
319329
Update user's a role for a resource (organization/database)
320330
321331
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
@@ -332,8 +342,66 @@ Update user's a role for a resource (organization/database)
332342
```js
333343
const dbId = "UserDatabase/acfcc2db02b83792sssb15239ccdf586fc5b176846ffe4878b1aea6a36c8f"
334344
const capId= "Capability/b395e8523d509dec6b33aefc9baed3b2e2bfadbd4c79d4ff9b20dce2b14e2edc"
335-
accessControl.updateUserRole('User/auth0%7C61790e11a3966d006906596a',capId,dbId,"Role/dataUpdater").then(result=>{
345+
accessControl.updateUserRole('User/auth0%7C61790e11a3966d006906596a',capId,dbId,
346+
"Role/dataUpdater").then(result=>{
336347
console.log(result)
337348
338349
})
339350
```
351+
352+
## accessRequestsList
353+
##### accessControl.accessRequestsList([orgName]) ⇒ <code>Promise</code>
354+
Get all the access request list for a specify organization
355+
356+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
357+
358+
| Param | Type | Description |
359+
| --- | --- | --- |
360+
| [orgName] | <code>string</code> | The organization name. |
361+
362+
**Example**
363+
```js
364+
accessControl.accessRequestsList().then(result=>{
365+
console.log(result)
366+
})
367+
```
368+
369+
## sendAccessRequest
370+
##### accessControl.sendAccessRequest([email], [affiliation], [note], [orgName]) ⇒ <code>Promise</code>
371+
Get all the access request list for a specify organization
372+
373+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
374+
375+
| Param | Type | Description |
376+
| --- | --- | --- |
377+
| [email] | <code>string</code> | the user email. |
378+
| [affiliation] | <code>string</code> | the user affiliation, company, university etc.. |
379+
| [note] | <code>string</code> | the message for the team admin |
380+
| [orgName] | <code>string</code> | The organization name. |
381+
382+
**Example**
383+
```js
384+
accessControl.sendAccessRequest("myemail@terminusdb.com",
385+
"my_company",
386+
"please add me to your team"
387+
).then(result=>{
388+
console.log(result)
389+
})
390+
```
391+
392+
## deleteAccessRequest
393+
##### accessControl.deleteAccessRequest([orgName]) ⇒ <code>Promise</code>
394+
Delete an access request to join your team, only an admin user can delete it
395+
396+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
397+
398+
| Param | Type | Description |
399+
| --- | --- | --- |
400+
| [orgName] | <code>string</code> | The organization name. |
401+
402+
**Example**
403+
```js
404+
accessControl.deleteAccessRequest("djjdshhsuuwewueueuiHYHYYW.......").then(result=>{
405+
console.log(result)
406+
})
407+
```

0 commit comments

Comments
 (0)