[ADF-2912] added group everyone as constant result for add permissions (#3266)

* [ADF-2556] first step to create add people or group to permissions

* [ADF-2556] creating a dialog with user results

* [ADF-2556]
integrated service for add and remove permission from node

* [ADF-2556] fixed behaviour and style for add user group

* [ADF-2556] added some refactoring for dialog service

* [ADF-2556] refactoring the dependencies of the components

* [ADF-2556] added some fix and a new key for dialog

* [ADF-2556] start adding test for node permission service

* [ADF-2556] added test for add permission panel component

* [ADf-2556] adding tests for new add permission component

* [ADF-2556] fixed tests and added documentation

* [ADF-2556] fixed documentation for add-node components

* [ADF-2556] added peer review changes

* [ADF-2912] added group everyone as constant result for add permissions

* [ADF-2912] readded jsdoc
This commit is contained in:
Vito 2018-05-11 10:44:24 +01:00 committed by Eugenio Romano
parent 18177f5697
commit dde0e1807b
5 changed files with 35 additions and 2 deletions

View File

@ -73,7 +73,7 @@ export class DemoPermissionComponent implements OnInit {
showErrorMessage(error) {
this.notificationService.openSnackMessage(
error,
JSON.parse(error.response.text).error.errorKey,
4000
);
}

View File

@ -271,7 +271,8 @@
"NO-RESULT": "No result found for this search",
"ADD-ACTION": "ADD",
"CLOSE-ACTION": "CLOSE",
"BASE-DIALOG-TITLE": "Search a group or people to add..."
"BASE-DIALOG-TITLE": "Search a group or people to add...",
"EVERYONE" : "EVERYONE"
},
"ERROR": {
"DUPLICATE-PERMISSION": "One or more of the permission you set is already present : {{list}}"

View File

@ -46,6 +46,17 @@
item.entry?.properties['cm:authorityName'] :
item.entry?.properties['cm:firstName']}}</p>
</mat-list-option>
<mat-list-option *ngIf="data?.list?.entries.length !== 0"
id="adf-add-permission-group-everyone"
class="adf-list-option-item"
(click)="elementClicked(EVERYONE)">
<mat-icon mat-list-icon id="add-group-icon">
group_add
</mat-icon>
<p>
{{'PERMISSION_MANAGER.ADD-PERMISSION.EVERYONE' | translate}}
</p>
</mat-list-option>
</mat-selection-list>
<div *ngIf="data?.list?.entries.length === 0" class="adf-permission-no-result" id="adf-add-permission-no-results">
<span>{{'PERMISSION_MANAGER.ADD-PERMISSION.NO-RESULT' | translate}}</span>

View File

@ -153,4 +153,23 @@ describe('AddPermissionPanelComponent', () => {
});
}));
it('should always show as extra result the everyone group', async(() => {
searchApiService = fixture.componentRef.injector.get(SearchService);
spyOn(searchApiService, 'search').and.returnValue(Observable.of(fakeAuthorityListResult));
component.selectedItems.push(fakeAuthorityListResult.list.entries[0]);
typeWordIntoSearchInput('a');
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(element.querySelector('#adf-add-permission-authority-results')).not.toBeNull();
expect(element.querySelector('#result_option_0 #add-person-icon')).toBeDefined();
expect(element.querySelector('#result_option_0 #add-person-icon')).not.toBeNull();
expect(element.querySelector('#result_option_2 #add-group-icon')).toBeDefined();
expect(element.querySelector('#result_option_2 #add-group-icon')).not.toBeNull();
expect(element.querySelector('#adf-add-permission-group-everyone')).toBeDefined();
expect(element.querySelector('#adf-add-permission-group-everyone')).not.toBeNull();
});
}));
});

View File

@ -48,6 +48,8 @@ export class AddPermissionPanelComponent {
selectedItems: MinimalNodeEntity[] = [];
EVERYONE: MinimalNodeEntity = { entry: { properties: {'cm:authorityName': 'GROUP_EVERYONE'}}};
constructor() {
this.searchInput.valueChanges
.pipe(