mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
* in progress * in progress testcase C297674 * linting fixes * modularised clear field method * made the appearance of select user dropdown work. * in progress * final version * linting fixes * linting fixes * in progress * in progress testcase C297674 * linting fixes * modularised clear field method * made the appearance of select user dropdown work. * in progress * final version * linting fixes * linting fixes * ADF-4103 automated * in progress * Roles Filter automated * async updates * removed the identity User details * roleId extraction done. * linting fixes * using constants instead of hardcoding the typing values. * crc's * crc's * linting * removed hte indexes, as api returns only 1 user record. * fixed errors * in progress * redoing the tests as the PeopleGroupCloudPage has been updated. * redoing the tests as the PeopleGroupCloudPage has been updated.
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright 2019 Alfresco Software, Ltd.
|
|
*
|
|
* 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 { ApiService } from '../APS-cloud/apiservice';
|
|
import { AppConfigService } from '@alfresco/adf-core';
|
|
|
|
export class Roles {
|
|
|
|
api: ApiService = new ApiService();
|
|
|
|
constructor(appConfig: AppConfigService) {
|
|
}
|
|
|
|
async init(username, password) {
|
|
await this.api.login(username, password);
|
|
}
|
|
|
|
async getRoleIdByRoleName(roleName) {
|
|
const path = `/roles`;
|
|
const method = 'GET';
|
|
let roleId;
|
|
const queryParams = {}, postBody = {};
|
|
|
|
const data = await this.api.performIdentityOperation(path, method, queryParams, postBody);
|
|
for (let key in data) {
|
|
if (data[key].name === roleName) {
|
|
roleId = data[key].id;
|
|
}
|
|
}
|
|
return roleId;
|
|
}
|
|
|
|
}
|