[ADF-5034] [GroupCloudComponent] Provide a way to make pre-selected groups read-only. (#5306)

* Added readonly property to the IdentityGroupModel.
* Updated unit tests.
* Changed class to interface.
* Updated doc
This commit is contained in:
siva kumar
2019-12-04 18:56:56 +05:30
committed by Maurizio Vitale
parent c01f2744b6
commit cc4c9bc567
7 changed files with 493 additions and 291 deletions

View File

@@ -18,30 +18,30 @@
import { IdentityGroupModel, IdentityGroupCountModel } from '../models/identity-group.model';
import { IdentityRoleModel } from '../models/identity-role.model';
export let mockIdentityGroup1 = new IdentityGroupModel({
export let mockIdentityGroup1 = <IdentityGroupModel> {
id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: []
});
};
export let mockIdentityGroup2 = new IdentityGroupModel({
export let mockIdentityGroup2 = <IdentityGroupModel> {
id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: []
});
};
export let mockIdentityGroup3 = new IdentityGroupModel({
export let mockIdentityGroup3 = <IdentityGroupModel> {
id: 'mock-group-id-3', name: 'Mock Group 3', path: '', subGroups: []
});
};
export let mockIdentityGroup4 = new IdentityGroupModel({
export let mockIdentityGroup4 = <IdentityGroupModel> {
id: 'mock-group-id-4', name: 'Mock Group 4', path: '', subGroups: []
});
};
export let mockIdentityGroup5 = new IdentityGroupModel({
export let mockIdentityGroup5 = <IdentityGroupModel> {
id: 'mock-group-id-5', name: 'Mock Group 5', path: '', subGroups: []
});
};
export let mockIdentityGroupsCount = <IdentityGroupCountModel> { count: 10 };
export let mockIdentityGroups = [
mockIdentityGroup1, mockIdentityGroup2, mockIdentityGroup3, mockIdentityGroup5, mockIdentityGroup5
mockIdentityGroup1, mockIdentityGroup2, mockIdentityGroup3, mockIdentityGroup4, mockIdentityGroup5
];
export let mockApplicationDetails = {id: 'mock-app-id', name: 'mock-app-name'};

View File

@@ -57,17 +57,17 @@ export const mockEffectiveRoles = [
export const mockJoinGroupRequest: IdentityJoinGroupRequestModel = {userId: 'mock-hser-id', groupId: 'mock-group-id', realm: 'mock-realm-name'};
export const mockGroup1 = new IdentityGroupModel({
export const mockGroup1 = <IdentityGroupModel> {
id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: []
});
};
export const mockGroup2 = new IdentityGroupModel({
export const mockGroup2 = <IdentityGroupModel> {
id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: []
});
};
export const mockGroups = [
new IdentityGroupModel({ id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: [] }),
new IdentityGroupModel({ id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: [] })
<IdentityGroupModel> { id: 'mock-group-id-1', name: 'Mock Group 1', path: '/mock', subGroups: [] },
<IdentityGroupModel> { id: 'mock-group-id-2', name: 'Mock Group 2', path: '', subGroups: [] }
];
export const queryUsersMockApi = {

View File

@@ -17,27 +17,15 @@
import { Pagination } from '@alfresco/js-api';
export class IdentityGroupModel {
id: string;
name: string;
path: string;
realmRoles: string[];
clientRoles: any;
access: any;
attributes: any;
constructor(obj?: any) {
if (obj) {
this.id = obj.id || null;
this.name = obj.name || null;
this.path = obj.path || null;
this.realmRoles = obj.realmRoles || null;
this.clientRoles = obj.clientRoles || null;
this.access = obj.access || null;
this.attributes = obj.attributes || null;
}
}
export interface IdentityGroupModel {
id?: string;
name?: string;
path?: string;
realmRoles?: string[];
clientRoles?: any;
access?: any;
attributes?: any;
readonly?: boolean;
}
export interface IdentityGroupSearchParam {
@@ -50,17 +38,9 @@ export interface IdentityGroupQueryResponse {
pagination: Pagination;
}
export class IdentityGroupQueryCloudRequestModel {
export interface IdentityGroupQueryCloudRequestModel {
first: number;
max: number;
constructor(obj?: any) {
if (obj) {
this.first = obj.first;
this.max = obj.max;
}
}
}
export interface IdentityGroupCountModel {