Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

Commit 89a574d

Browse files
committed
MINOR: add project check access route(#561)
* Add projcte check-access route * add route description * update tests with new invitation routes
1 parent 9a2b797 commit 89a574d

File tree

9 files changed

+416
-3
lines changed

9 files changed

+416
-3
lines changed

.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ docs/Building.md
99
docs/BuildingModelPlanRequest.md
1010
docs/CheckPlan.md
1111
docs/CheckPlanRequest.md
12+
docs/CheckProjectAccess.md
1213
docs/CheckerApi.md
1314
docs/CheckerResult.md
1415
docs/CheckerResultRequest.md
@@ -269,6 +270,7 @@ src/model/Building.js
269270
src/model/BuildingModelPlanRequest.js
270271
src/model/CheckPlan.js
271272
src/model/CheckPlanRequest.js
273+
src/model/CheckProjectAccess.js
272274
src/model/CheckerResult.js
273275
src/model/CheckerResultRequest.js
274276
src/model/Classification.js
@@ -519,6 +521,7 @@ test/model/Building.spec.js
519521
test/model/BuildingModelPlanRequest.spec.js
520522
test/model/CheckPlan.spec.js
521523
test/model/CheckPlanRequest.spec.js
524+
test/model/CheckProjectAccess.spec.js
522525
test/model/CheckerResult.spec.js
523526
test/model/CheckerResultRequest.spec.js
524527
test/model/Classification.spec.js

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ Class | Method | HTTP request | Description
231231
*bimdata.CollaborationApi* | [**cancelCloudUserInvitation**](docs/CollaborationApi.md#cancelCloudUserInvitation) | **DELETE** /cloud/{cloud_pk}/invitation/{id} | Cancel a pending invitation
232232
*bimdata.CollaborationApi* | [**cancelProjectUserInvitation**](docs/CollaborationApi.md#cancelProjectUserInvitation) | **DELETE** /cloud/{cloud_pk}/project/{project_pk}/invitation/{id} | Cancel a pending invitation
233233
*bimdata.CollaborationApi* | [**checkAccess**](docs/CollaborationApi.md#checkAccess) | **GET** /cloud/{id}/check-access | Check app access from cloud
234+
*bimdata.CollaborationApi* | [**checkProjectAccess**](docs/CollaborationApi.md#checkProjectAccess) | **GET** /cloud/{cloud_pk}/project/{id}/check-access | Check if the current token has access to the requested project
234235
*bimdata.CollaborationApi* | [**closeVisa**](docs/CollaborationApi.md#closeVisa) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{id}/close | Close a visa of a document
235236
*bimdata.CollaborationApi* | [**createClassification**](docs/CollaborationApi.md#createClassification) | **POST** /cloud/{cloud_pk}/project/{project_pk}/classification | Create a classification
236237
*bimdata.CollaborationApi* | [**createCloud**](docs/CollaborationApi.md#createCloud) | **POST** /cloud | Create a cloud
@@ -650,6 +651,7 @@ Class | Method | HTTP request | Description
650651
- [bimdata.BuildingModelPlanRequest](docs/BuildingModelPlanRequest.md)
651652
- [bimdata.CheckPlan](docs/CheckPlan.md)
652653
- [bimdata.CheckPlanRequest](docs/CheckPlanRequest.md)
654+
- [bimdata.CheckProjectAccess](docs/CheckProjectAccess.md)
653655
- [bimdata.CheckerResult](docs/CheckerResult.md)
654656
- [bimdata.CheckerResultRequest](docs/CheckerResultRequest.md)
655657
- [bimdata.Classification](docs/Classification.md)

docs/CheckProjectAccess.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# bimdata.CheckProjectAccess
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**hasReadPermission** | **Boolean** | |
8+
**hasWritePermission** | **Boolean** | |
9+
**hasAdminPermission** | **Boolean** | |
10+
**tokenScopes** | **[String]** | |
11+
**usableScopes** | **[String]** | Some tokens may have write scopes (eg: model:write) but the user of the token is a guest in the project so they can't use the scopes. |
12+
**userRole** | **Number** | | [optional]
13+
14+
15+
16+
## Enum: UserRoleEnum
17+
18+
19+
* `100` (value: `100`)
20+
21+
* `50` (value: `50`)
22+
23+
* `25` (value: `25`)
24+
25+
26+
27+

docs/CollaborationApi.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Method | HTTP request | Description
1111
[**cancelCloudUserInvitation**](CollaborationApi.md#cancelCloudUserInvitation) | **DELETE** /cloud/{cloud_pk}/invitation/{id} | Cancel a pending invitation
1212
[**cancelProjectUserInvitation**](CollaborationApi.md#cancelProjectUserInvitation) | **DELETE** /cloud/{cloud_pk}/project/{project_pk}/invitation/{id} | Cancel a pending invitation
1313
[**checkAccess**](CollaborationApi.md#checkAccess) | **GET** /cloud/{id}/check-access | Check app access from cloud
14+
[**checkProjectAccess**](CollaborationApi.md#checkProjectAccess) | **GET** /cloud/{cloud_pk}/project/{id}/check-access | Check if the current token has access to the requested project
1415
[**closeVisa**](CollaborationApi.md#closeVisa) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{id}/close | Close a visa of a document
1516
[**createClassification**](CollaborationApi.md#createClassification) | **POST** /cloud/{cloud_pk}/project/{project_pk}/classification | Create a classification
1617
[**createCloud**](CollaborationApi.md#createCloud) | **POST** /cloud | Create a cloud
@@ -564,6 +565,69 @@ null (empty response body)
564565
- **Accept**: Not defined
565566

566567

568+
## checkProjectAccess
569+
570+
> CheckProjectAccess checkProjectAccess(cloudPk, id)
571+
572+
Check if the current token has access to the requested project
573+
574+
The response gives you details about the right of the user or app, the scopes of the token and the usable scopes (scopes filtered by the right of the user). It works with user tokens, app tokens and ProjectAccessToken
575+
576+
### Example
577+
578+
```javascript
579+
import bimdata from '@bimdata/bimdata-api-client';
580+
let defaultClient = bimdata.ApiClient.instance;
581+
// Configure API key authorization: ApiKey
582+
let ApiKey = defaultClient.authentications['ApiKey'];
583+
ApiKey.apiKey = 'YOUR API KEY';
584+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
585+
//ApiKey.apiKeyPrefix = 'Token';
586+
// Configure OAuth2 access token for authorization: BIMData_Connect
587+
let BIMData_Connect = defaultClient.authentications['BIMData_Connect'];
588+
BIMData_Connect.accessToken = 'YOUR ACCESS TOKEN';
589+
// Configure OAuth2 access token for authorization: BIMData_Connect
590+
let BIMData_Connect = defaultClient.authentications['BIMData_Connect'];
591+
BIMData_Connect.accessToken = 'YOUR ACCESS TOKEN';
592+
// Configure API key authorization: Bearer
593+
let Bearer = defaultClient.authentications['Bearer'];
594+
Bearer.apiKey = 'YOUR API KEY';
595+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
596+
//Bearer.apiKeyPrefix = 'Token';
597+
598+
let apiInstance = new bimdata.CollaborationApi();
599+
let cloudPk = 56; // Number |
600+
let id = 56; // Number | A unique integer value identifying this project.
601+
apiInstance.checkProjectAccess(cloudPk, id).then((data) => {
602+
console.log('API called successfully. Returned data: ' + data);
603+
}, (error) => {
604+
console.error(error);
605+
});
606+
607+
```
608+
609+
### Parameters
610+
611+
612+
Name | Type | Description | Notes
613+
------------- | ------------- | ------------- | -------------
614+
**cloudPk** | **Number**| |
615+
**id** | **Number**| A unique integer value identifying this project. |
616+
617+
### Return type
618+
619+
[**CheckProjectAccess**](CheckProjectAccess.md)
620+
621+
### Authorization
622+
623+
[ApiKey](../README.md#ApiKey), [BIMData_Connect](../README.md#BIMData_Connect), [BIMData_Connect](../README.md#BIMData_Connect), [Bearer](../README.md#Bearer)
624+
625+
### HTTP request headers
626+
627+
- **Content-Type**: Not defined
628+
- **Accept**: application/json
629+
630+
567631
## closeVisa
568632

569633
> closeVisa(cloudPk, documentPk, id, projectPk)
@@ -889,7 +953,7 @@ Name | Type | Description | Notes
889953
890954
Create a document
891955

892-
Create a document. If the document is one of {'POINT_CLOUD', 'DAE', 'DXF', 'GLTF', 'BFX', 'DWG', 'IFC', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write
956+
Create a document. If the document is one of {'DAE', 'DXF', 'DWG', 'POINT_CLOUD', 'BFX', 'IFC', 'GLTF', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write
893957

894958
### Example
895959

src/api/CollaborationApi.js

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414

1515
import ApiClient from "../ApiClient";
16+
import CheckProjectAccess from '../model/CheckProjectAccess';
1617
import Classification from '../model/Classification';
1718
import ClassificationRequest from '../model/ClassificationRequest';
1819
import Cloud from '../model/Cloud';
@@ -512,6 +513,61 @@ export default class CollaborationApi {
512513
}
513514

514515

516+
/**
517+
* Check if the current token has access to the requested project
518+
* The response gives you details about the right of the user or app, the scopes of the token and the usable scopes (scopes filtered by the right of the user). It works with user tokens, app tokens and ProjectAccessToken
519+
* @param {Number} cloudPk
520+
* @param {Number} id A unique integer value identifying this project.
521+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CheckProjectAccess} and HTTP response
522+
*/
523+
checkProjectAccessWithHttpInfo(cloudPk, id) {
524+
let postBody = null;
525+
// verify the required parameter 'cloudPk' is set
526+
if (cloudPk === undefined || cloudPk === null) {
527+
throw new Error("Missing the required parameter 'cloudPk' when calling checkProjectAccess");
528+
}
529+
// verify the required parameter 'id' is set
530+
if (id === undefined || id === null) {
531+
throw new Error("Missing the required parameter 'id' when calling checkProjectAccess");
532+
}
533+
534+
let pathParams = {
535+
'cloud_pk': cloudPk,
536+
'id': id
537+
};
538+
let queryParams = {
539+
};
540+
let headerParams = {
541+
};
542+
let formParams = {
543+
};
544+
545+
let authNames = ['ApiKey', 'BIMData_Connect', 'BIMData_Connect', 'Bearer'];
546+
let contentTypes = [];
547+
let accepts = ['application/json'];
548+
let returnType = CheckProjectAccess;
549+
return this.apiClient.callApi(
550+
'/cloud/{cloud_pk}/project/{id}/check-access', 'GET',
551+
pathParams, queryParams, headerParams, formParams, postBody,
552+
authNames, contentTypes, accepts, returnType, null
553+
);
554+
}
555+
556+
/**
557+
* Check if the current token has access to the requested project
558+
* The response gives you details about the right of the user or app, the scopes of the token and the usable scopes (scopes filtered by the right of the user). It works with user tokens, app tokens and ProjectAccessToken
559+
* @param {Number} cloudPk
560+
* @param {Number} id A unique integer value identifying this project.
561+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CheckProjectAccess}
562+
*/
563+
checkProjectAccess(cloudPk, id) {
564+
return this.checkProjectAccessWithHttpInfo(cloudPk, id)
565+
.then(function(response_and_data) {
566+
return response_and_data.data;
567+
});
568+
}
569+
570+
515571
/**
516572
* Close a visa of a document
517573
* Close a visa of a document Required scopes: document:write
@@ -800,7 +856,7 @@ export default class CollaborationApi {
800856

801857
/**
802858
* Create a document
803-
* Create a document. If the document is one of {'POINT_CLOUD', 'DAE', 'DXF', 'GLTF', 'BFX', 'DWG', 'IFC', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write
859+
* Create a document. If the document is one of {'DAE', 'DXF', 'DWG', 'POINT_CLOUD', 'BFX', 'IFC', 'GLTF', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write
804860
* @param {Number} cloudPk A unique integer value identifying this cloud.
805861
* @param {Number} projectPk A unique integer value identifying this project.
806862
* @param {String} name Shown name of the file
@@ -868,7 +924,7 @@ export default class CollaborationApi {
868924

869925
/**
870926
* Create a document
871-
* Create a document. If the document is one of {'POINT_CLOUD', 'DAE', 'DXF', 'GLTF', 'BFX', 'DWG', 'IFC', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write
927+
* Create a document. If the document is one of {'DAE', 'DXF', 'DWG', 'POINT_CLOUD', 'BFX', 'IFC', 'GLTF', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write
872928
* @param {Number} cloudPk A unique integer value identifying this cloud.
873929
* @param {Number} projectPk A unique integer value identifying this project.
874930
* @param {String} name Shown name of the file

src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Building from './model/Building';
1919
import BuildingModelPlanRequest from './model/BuildingModelPlanRequest';
2020
import CheckPlan from './model/CheckPlan';
2121
import CheckPlanRequest from './model/CheckPlanRequest';
22+
import CheckProjectAccess from './model/CheckProjectAccess';
2223
import CheckerResult from './model/CheckerResult';
2324
import CheckerResultRequest from './model/CheckerResultRequest';
2425
import Classification from './model/Classification';
@@ -339,6 +340,12 @@ export {
339340
*/
340341
CheckPlanRequest,
341342

343+
/**
344+
* The CheckProjectAccess model constructor.
345+
* @property {module:model/CheckProjectAccess}
346+
*/
347+
CheckProjectAccess,
348+
342349
/**
343350
* The CheckerResult model constructor.
344351
* @property {module:model/CheckerResult}

0 commit comments

Comments
 (0)