mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-9377] remove the join button for records management library for user s without permissions for that library (#10901)
* [ACS-9377] Added function for file plans to get file plan roles * [ACS-9377] Types and documentation * [ACS-9377] Unit tests * [ACS-9377] Fixed sonar cloud issue
This commit is contained in:
@@ -24,6 +24,7 @@ import { BaseApi } from './base.api';
|
||||
import { buildCollectionParam } from '../../../alfrescoApiClient';
|
||||
import { throwIfNotDefined } from '../../../assert';
|
||||
import { RecordsIncludeQuery, RecordsPagingQuery, RecordsSourceQuery } from './types';
|
||||
import { FilePlanRolePaging, FilePlanRoleParameters } from '../model';
|
||||
|
||||
/**
|
||||
* FilePlansApi service.
|
||||
@@ -158,4 +159,26 @@ export class FilePlansApi extends BaseApi {
|
||||
returnType: FilePlanEntry
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of roles for the specified file plan.
|
||||
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
||||
* @param parameters Optional parameters
|
||||
* @returns Promise<FilePlanEntry>
|
||||
*/
|
||||
getFilePlanRoles(filePlanId: string, parameters?: FilePlanRoleParameters): Promise<FilePlanRolePaging> {
|
||||
throwIfNotDefined(filePlanId, 'filePlanId');
|
||||
|
||||
return this.get({
|
||||
path: '/file-plans/{filePlanId}/roles',
|
||||
pathParams: {
|
||||
filePlanId
|
||||
},
|
||||
queryParams: {
|
||||
where: parameters?.where?.capabilityNames
|
||||
? `(capabilityName in (${parameters.where.capabilityNames.map((value) => "'" + value + "'").join(', ')}))`
|
||||
: undefined
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
12
lib/js-api/src/api/gs-core-rest-api/docs/FilePlanRole.md
Normal file
12
lib/js-api/src/api/gs-core-rest-api/docs/FilePlanRole.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# FilePlanRole
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|--------------------|-----------------------------------------------------------|
|
||||
| **displayLabel** | string |
|
||||
| **groupShortName** | string |
|
||||
| **name** | string |
|
||||
| **roleGroupName** | string |
|
||||
| **capabilities** | [**FilePlanRoleCapability[]**](FilePlanRoleCapability.md) |
|
||||
|
||||
|
@@ -0,0 +1,11 @@
|
||||
# FilePLanRoleCapability
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|-----------|-------------------------------------------------------------------|
|
||||
| **group** | [**FilePlanRoleCapabilityGroup**](FilePlanRoleCapabilityGroup.md) |
|
||||
| **index** | number |
|
||||
| **name** | string |
|
||||
| **title** | string |
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
# FilePlanRoleCapabilityGroup
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|-----------|--------|
|
||||
| **id** | string |
|
||||
| **title** | string |
|
||||
|
||||
|
@@ -0,0 +1,8 @@
|
||||
# FilePlanRoleEntry
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|-----------|-------------------------------------|
|
||||
| **entry** | [**FilePlanRole**](FilePlanRole.md) |
|
||||
|
||||
|
@@ -0,0 +1,8 @@
|
||||
# FilePLanRolePaging
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|----------|---------------------------------------------------------|
|
||||
| **list** | [**FilePlanRolePagingList**](FilePlanRolePagingList.md) |
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
# FilePLanRolePagingList
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|----------------|-------------------------------------------------------------|
|
||||
| **entries** | [**FilePlanRoleEntry[]**](FilePlanRoleEntry.md) |
|
||||
| **pagination** | [**Pagination**](../../content-rest-api/docs/Pagination.md) |
|
||||
|
||||
|
@@ -0,0 +1,8 @@
|
||||
# FilePlanRoleParameters
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|-----------|-------------------------------------------------------------------|
|
||||
| **where** | [**FilePlanRoleParametersWhere**](FilePlanRoleParametersWhere.md) |
|
||||
|
||||
|
@@ -0,0 +1,8 @@
|
||||
# FilePlanRoleParametersWhere
|
||||
|
||||
## Properties
|
||||
| Name | Type |
|
||||
|---------------------|----------|
|
||||
| **capabilityNames** | string[] |
|
||||
|
||||
|
@@ -2,13 +2,13 @@
|
||||
|
||||
All URIs are relative to *https://localhost/alfresco/api/-default-/public/gs/versions/1*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createFilePlanCategories**](FilePlansApi.md#createFilePlanCategories) | **POST** /file-plans/{filePlanId}/categories | Create record categories for a file plan
|
||||
[**getFilePlan**](FilePlansApi.md#getFilePlan) | **GET** /file-plans/{filePlanId} | Get a file plan
|
||||
[**getFilePlanCategories**](FilePlansApi.md#getFilePlanCategories) | **GET** /file-plans/{filePlanId}/categories | List file plans's children
|
||||
[**updateFilePlan**](FilePlansApi.md#updateFilePlan) | **PUT** /file-plans/{filePlanId} | Update a file plan
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|--------------------------------------------------------------------------|----------------------------------------------|---------------------------------------------------|
|
||||
| [**createFilePlanCategories**](FilePlansApi.md#createFilePlanCategories) | **POST** /file-plans/{filePlanId}/categories | Create record categories for a file plan |
|
||||
| [**getFilePlan**](FilePlansApi.md#getFilePlan) | **GET** /file-plans/{filePlanId} | Get a file plan |
|
||||
| [**getFilePlanCategories**](FilePlansApi.md#getFilePlanCategories) | **GET** /file-plans/{filePlanId}/categories | List file plans's children |
|
||||
| [**updateFilePlan**](FilePlansApi.md#updateFilePlan) | **PUT** /file-plans/{filePlanId} | Update a file plan |
|
||||
| [**getFilePlanRoles**](FilePlansApi.md#getFilePlanRoles) | **GET** /file-plans/{filePlanId}/roles | Gets a list of roles for the specified file plan. |
|
||||
|
||||
<a name="createFilePlanCategories"></a>
|
||||
# **createFilePlanCategories**
|
||||
@@ -402,3 +402,39 @@ parameter are returned in addition to those specified in the **fields** paramete
|
||||
|
||||
[**FilePlanEntry**](FilePlanEntry.md)
|
||||
|
||||
<a name="getFilePlanRoles"></a>
|
||||
# **getFilePlanRoles**
|
||||
> FilePlanEntry getFilePlanRoles(filePlanId, parameters)
|
||||
|
||||
Gets a list of roles for the specified file plan.
|
||||
|
||||
### Example
|
||||
```javascript
|
||||
import FilePlansApi from 'FilePlansApi';
|
||||
import { AlfrescoApi } from '@alfresco/js-api';
|
||||
|
||||
this.alfrescoApi = new AlfrescoApi();
|
||||
this.alfrescoApi.setConfig({
|
||||
hostEcm: 'http://127.0.0.1:8080'
|
||||
});
|
||||
|
||||
let fileplansApi = new FilePlansApi(this.alfrescoApi);
|
||||
const filePlanId = 'some id';
|
||||
fileplansApi.updateFilePlan(filePlanId, {
|
||||
where: {
|
||||
capabilityNames: ['ViewRecords']
|
||||
}
|
||||
}).then((data) => console.log('API called successfully. Returned data: ' + data))
|
||||
.catch((error) => console.log(error));
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
|----------------|---------------------------------------------------------|-----------------------------------------------------------------------|
|
||||
| **filePlanId** | **string** | The identifier of a file plan. You can also use the -filePlan- alias. |
|
||||
| **parameters** | [**FilePlanRoleParameters**](FilePlanRoleParameters.md) | Optional parameters. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**FilePlanRolePaging**](FilePlanRolePaging.md)
|
||||
|
33
lib/js-api/src/api/gs-core-rest-api/model/filePlanRole.ts
Normal file
33
lib/js-api/src/api/gs-core-rest-api/model/filePlanRole.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FilePlanRoleCapability } from './filePlanRoleCapability';
|
||||
|
||||
export class FilePlanRole {
|
||||
displayLabel: string;
|
||||
groupShortName: string;
|
||||
name: string;
|
||||
roleGroupName: string;
|
||||
capabilities: FilePlanRoleCapability[];
|
||||
|
||||
constructor(input?: Partial<FilePlanRole>) {
|
||||
if (input) {
|
||||
Object.assign(this, input);
|
||||
this.capabilities = input.capabilities?.map((capability) => new FilePlanRoleCapability(capability));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FilePlanRoleCapabilityGroup } from './filePlanRoleCapabilityGroup';
|
||||
|
||||
export class FilePlanRoleCapability {
|
||||
group: FilePlanRoleCapabilityGroup;
|
||||
index: number;
|
||||
name: string;
|
||||
title: string;
|
||||
|
||||
constructor(input?: Partial<FilePlanRoleCapability>) {
|
||||
if (input) {
|
||||
Object.assign(this, input);
|
||||
this.group = input.group ? new FilePlanRoleCapabilityGroup(input.group) : undefined;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export class FilePlanRoleCapabilityGroup {
|
||||
id: string;
|
||||
title: string;
|
||||
|
||||
constructor(input?: Partial<FilePlanRoleCapabilityGroup>) {
|
||||
if (input) {
|
||||
Object.assign(this, input);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FilePlanRole } from './filePlanRole';
|
||||
|
||||
export class FilePlanRoleEntry {
|
||||
entry: FilePlanRole;
|
||||
|
||||
constructor(input?: Partial<FilePlanRoleEntry>) {
|
||||
if (input) {
|
||||
Object.assign(this, input);
|
||||
this.entry = input.entry ? new FilePlanRole(input.entry) : undefined;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FilePlanRolePagingList } from './filePlanRolePagingList';
|
||||
|
||||
export class FilePlanRolePaging {
|
||||
list: FilePlanRolePagingList;
|
||||
|
||||
constructor(input: Partial<FilePlanRolePaging>) {
|
||||
if (input) {
|
||||
Object.assign(this, input);
|
||||
this.list = input.list ? new FilePlanRolePagingList(input.list) : undefined;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Pagination } from '../../content-rest-api';
|
||||
import { FilePlanRoleEntry } from './filePlanRoleEntry';
|
||||
|
||||
export class FilePlanRolePagingList {
|
||||
entries: FilePlanRoleEntry[];
|
||||
pagination: Pagination;
|
||||
|
||||
constructor(input: Partial<FilePlanRolePagingList>) {
|
||||
if (input) {
|
||||
Object.assign(this, input);
|
||||
this.pagination = input.pagination ? new Pagination(input.pagination) : undefined;
|
||||
this.entries = input?.entries.map((entry) => new FilePlanRoleEntry(entry));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FilePlanRoleParametersWhere } from './filePlanRoleParametersWhere';
|
||||
|
||||
export interface FilePlanRoleParameters {
|
||||
where?: FilePlanRoleParametersWhere;
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface FilePlanRoleParametersWhere {
|
||||
capabilityNames?: string[];
|
||||
}
|
@@ -19,6 +19,14 @@ export * from './filePlan';
|
||||
export * from './filePlanBodyUpdate';
|
||||
export * from './filePlanComponentBodyUpdate';
|
||||
export * from './filePlanEntry';
|
||||
export * from './filePlanRole';
|
||||
export * from './filePlanRoleCapability';
|
||||
export * from './filePlanRoleCapabilityGroup';
|
||||
export * from './filePlanRoleEntry';
|
||||
export * from './filePlanRolePaging';
|
||||
export * from './filePlanRolePagingList';
|
||||
export * from './filePlanRoleParameters';
|
||||
export * from './filePlanRoleParametersWhere';
|
||||
export * from './rMNodeBodyCreate';
|
||||
export * from './rMNodeBodyCreateWithRelativePath';
|
||||
export * from './rMSite';
|
||||
|
129
lib/js-api/test/governance-services/filePlansApi.spec.ts
Normal file
129
lib/js-api/test/governance-services/filePlansApi.spec.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { EcmAuthMock, FilePlansMock } from '../mockObjects';
|
||||
import { AlfrescoApi, FilePlanRolePaging, FilePlansApi } from '../../src';
|
||||
|
||||
describe('FilePlansApi', () => {
|
||||
let filePlansApiMock: FilePlansMock;
|
||||
let filePlansApi: FilePlansApi;
|
||||
|
||||
beforeEach(async () => {
|
||||
const hostEcm = 'https://127.0.0.1:8080';
|
||||
const authResponseMock = new EcmAuthMock(hostEcm);
|
||||
authResponseMock.get201Response();
|
||||
filePlansApiMock = new FilePlansMock(hostEcm);
|
||||
const alfrescoApi = new AlfrescoApi({
|
||||
hostEcm
|
||||
});
|
||||
filePlansApi = new FilePlansApi(alfrescoApi);
|
||||
await alfrescoApi.login('admin', 'admin');
|
||||
});
|
||||
|
||||
describe('getFilePlanRoles', () => {
|
||||
let expectedRolePaging: FilePlanRolePaging;
|
||||
|
||||
beforeEach(() => {
|
||||
expectedRolePaging = {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
displayLabel: 'Role One',
|
||||
groupShortName: 'group short name 1',
|
||||
name: 'role1',
|
||||
roleGroupName: 'role group name 1',
|
||||
capabilities: [
|
||||
{
|
||||
index: 0,
|
||||
name: 'capability1',
|
||||
title: 'Capability One',
|
||||
group: {
|
||||
id: 'group1',
|
||||
title: 'Group One'
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 1,
|
||||
name: 'capability2',
|
||||
title: 'Capability Two',
|
||||
group: {
|
||||
id: 'group2',
|
||||
title: 'Group Two'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
displayLabel: 'Role Two',
|
||||
groupShortName: 'group short name 2',
|
||||
name: 'role2',
|
||||
roleGroupName: 'role group name 2',
|
||||
capabilities: [
|
||||
{
|
||||
index: 0,
|
||||
name: 'capability3',
|
||||
title: 'Capability Three',
|
||||
group: {
|
||||
id: 'group3',
|
||||
title: 'Group Three'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
it('should get file plan roles', (done) => {
|
||||
const filePlanId = 'filePlanId123';
|
||||
filePlansApiMock.get200FilePlanRoles(filePlanId);
|
||||
|
||||
filePlansApi.getFilePlanRoles(filePlanId).then((rolePaging) => {
|
||||
expect(rolePaging).toEqual(expectedRolePaging);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should get file plan roles with filtering by capability names', (done) => {
|
||||
const filePlanId = 'filePlanId123';
|
||||
filePlansApiMock.get200FilePlanRolesWithFilteringByCapabilityNames(filePlanId);
|
||||
|
||||
filePlansApi
|
||||
.getFilePlanRoles(filePlanId, {
|
||||
where: {
|
||||
capabilityNames: ['capability1', 'capability2']
|
||||
}
|
||||
})
|
||||
.then((rolePaging) => {
|
||||
expect(rolePaging).toEqual(expectedRolePaging);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -0,0 +1,101 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseMock } from '../base.mock';
|
||||
import nock from 'nock';
|
||||
import { FilePlanRolePaging } from '@alfresco/js-api';
|
||||
|
||||
export class FilePlansMock extends BaseMock {
|
||||
get200FilePlanRoles(filePlanId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/gs/versions/1/file-plans/${filePlanId}/roles`)
|
||||
.query({})
|
||||
.reply(200, this.mockFilePlanRolePaging());
|
||||
}
|
||||
|
||||
get200FilePlanRolesWithFilteringByCapabilityNames(filePlanId: string): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.get(`/alfresco/api/-default-/public/gs/versions/1/file-plans/${filePlanId}/roles`)
|
||||
.query({
|
||||
where: "(capabilityName in ('capability1', 'capability2'))"
|
||||
})
|
||||
.reply(200, this.mockFilePlanRolePaging());
|
||||
}
|
||||
|
||||
private mockFilePlanRolePaging(): FilePlanRolePaging {
|
||||
return {
|
||||
list: {
|
||||
pagination: {
|
||||
count: 2,
|
||||
hasMoreItems: false,
|
||||
totalItems: 2,
|
||||
skipCount: 0,
|
||||
maxItems: 100
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
displayLabel: 'Role One',
|
||||
groupShortName: 'group short name 1',
|
||||
name: 'role1',
|
||||
roleGroupName: 'role group name 1',
|
||||
capabilities: [
|
||||
{
|
||||
index: 0,
|
||||
name: 'capability1',
|
||||
title: 'Capability One',
|
||||
group: {
|
||||
id: 'group1',
|
||||
title: 'Group One'
|
||||
}
|
||||
},
|
||||
{
|
||||
index: 1,
|
||||
name: 'capability2',
|
||||
title: 'Capability Two',
|
||||
group: {
|
||||
id: 'group2',
|
||||
title: 'Group Two'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
displayLabel: 'Role Two',
|
||||
groupShortName: 'group short name 2',
|
||||
name: 'role2',
|
||||
roleGroupName: 'role group name 2',
|
||||
capabilities: [
|
||||
{
|
||||
index: 0,
|
||||
name: 'capability3',
|
||||
title: 'Capability Three',
|
||||
group: {
|
||||
id: 'group3',
|
||||
title: 'Group Three'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@@ -34,6 +34,7 @@ export * from './content-services/version.mock';
|
||||
export * from './content-services/webscript.mock';
|
||||
|
||||
export * from './goverance-services/authority-clearance.mock';
|
||||
export * from './goverance-services/file-plans.mock';
|
||||
export * from './goverance-services/gs-sites.mock';
|
||||
export * from './goverance-services/node-security-marks.mock';
|
||||
export * from './goverance-services/security-groups.mock';
|
||||
|
Reference in New Issue
Block a user