diff --git a/demo-shell/resources/i18n/en.json b/demo-shell/resources/i18n/en.json index 20eb25d03c..af2536eae6 100644 --- a/demo-shell/resources/i18n/en.json +++ b/demo-shell/resources/i18n/en.json @@ -89,6 +89,7 @@ "VERSIONS": "Manage versions", "METADATA": "Info", "DOWNLOAD": "Download", + "PERMISSION": "Permission", "FOLDER": { "COPY": "Copy", "MOVE": "Move", diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index c739a355b9..ab1998dac5 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -47,6 +47,7 @@ import { ReactiveFormsModule } from '@angular/forms'; import { TaskAttachmentsComponent } from './components/process-service/task-attachments.component'; import { ProcessAttachmentsComponent } from './components/process-service/process-attachments.component'; import { SharedLinkViewComponent } from './components/shared-link-view/shared-link-view.component'; +import { DemoPermissionComponent } from './components/permissions/demo-permissions.component'; @NgModule({ @@ -94,7 +95,8 @@ import { SharedLinkViewComponent } from './components/shared-link-view/shared-li ProcessAttachmentsComponent, OverlayViewerComponent, SharedLinkViewComponent, - FormLoadingComponent + FormLoadingComponent, + DemoPermissionComponent ], providers: [ { provide: AppConfigService, useClass: DebugAppConfigService }, diff --git a/demo-shell/src/app/app.routes.ts b/demo-shell/src/app/app.routes.ts index 30e317e3cc..4377aada4e 100644 --- a/demo-shell/src/app/app.routes.ts +++ b/demo-shell/src/app/app.routes.ts @@ -46,6 +46,7 @@ import { FormListComponent } from './components/form/form-list.component'; import { OverlayViewerComponent } from './components/overlay-viewer/overlay-viewer.component'; import { SharedLinkViewComponent } from './components/shared-link-view/shared-link-view.component'; import { FormLoadingComponent } from './components/form/form-loading.component'; +import { DemoPermissionComponent } from './components/permissions/demo-permissions.component'; export const appRoutes: Routes = [ { path: 'login', component: LoginComponent }, @@ -165,6 +166,11 @@ export const appRoutes: Routes = [ component: SocialComponent, canActivate: [AuthGuardEcm] }, + { + path: 'permissions/:id', + component: DemoPermissionComponent, + canActivate: [AuthGuardEcm] + }, { path: 'about', component: AboutComponent }, { path: 'form', component: FormComponent }, { path: 'form-list', component: FormListComponent }, diff --git a/demo-shell/src/app/components/datatable/datatable.component.ts b/demo-shell/src/app/components/datatable/datatable.component.ts index daf7d17901..cb8c92cc59 100644 --- a/demo-shell/src/app/components/datatable/datatable.component.ts +++ b/demo-shell/src/app/components/datatable/datatable.component.ts @@ -178,7 +178,7 @@ export class DataTableComponent { getRowForNode() { const opts: any = { includeSource: true, - include: ['path', 'properties', 'allowableOperations'] + include: ['path', 'properties', 'allowableOperations', 'permissions'] }; Observable.fromPromise(this.apiService.getInstance().nodes diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index 0a57d672fd..33e0dd15ef 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -308,6 +308,13 @@ title="DOCUMENT_LIST.ACTIONS.DOCUMENT.PROCESS_ACTION" (execute)="startProcesAction($event)"> + + + diff --git a/demo-shell/src/app/components/permissions/demo-permissions.component.scss b/demo-shell/src/app/components/permissions/demo-permissions.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/demo-shell/src/app/components/permissions/demo-permissions.component.ts b/demo-shell/src/app/components/permissions/demo-permissions.component.ts new file mode 100644 index 0000000000..294aab1f9d --- /dev/null +++ b/demo-shell/src/app/components/permissions/demo-permissions.component.ts @@ -0,0 +1,43 @@ +/*! + * @license + * Copyright 2016 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 { Component, Optional, OnInit } from '@angular/core'; +import { ActivatedRoute, Params} from '@angular/router'; + +@Component({ + selector: 'app-permissions', + templateUrl: './demo-permissions.component.html', + styleUrls: ['./demo-permissions.component.scss'] +}) +export class DemoPermissionComponent implements OnInit { + + nodeId: string; + + constructor(@Optional() private route: ActivatedRoute) { + } + + ngOnInit() { + if (this.route) { + this.route.params.forEach((params: Params) => { + if (params['id']) { + this.nodeId = params['id']; + } + }); + } + } + +} diff --git a/docs/content-services/permission-list.component.md b/docs/content-services/permission-list.component.md new file mode 100644 index 0000000000..d034a024a3 --- /dev/null +++ b/docs/content-services/permission-list.component.md @@ -0,0 +1,26 @@ +--- +Added: v2.3.0 +Status: Active +Last reviewed: 2018-03-12 +--- + +# Permission List Component + +![Permission List](../docassets/images/adf-permission-list.png) + +## Basic Usage + +```html + + +``` + +### Properties + +| Name | Type | Default value | Description | +| ---- | ---- | ------------- | ----------- | +| nodeId | `string` | `null` | node id which we want to show the permissions | + +## Details + +This component use the `datatable` to show the permission retrieved from the node service. \ No newline at end of file diff --git a/docs/docassets/images/adf-permission-list.png b/docs/docassets/images/adf-permission-list.png new file mode 100644 index 0000000000..0fbea26de2 Binary files /dev/null and b/docs/docassets/images/adf-permission-list.png differ diff --git a/lib/content-services/content.module.ts b/lib/content-services/content.module.ts index 4227939705..e4fa82a884 100644 --- a/lib/content-services/content.module.ts +++ b/lib/content-services/content.module.ts @@ -36,6 +36,7 @@ import { ContentDirectiveModule } from './directives/content-directive.module'; import { DialogModule } from './dialogs/dialog.module'; import { FolderDirectiveModule } from './folder-directive/folder-directive.module'; import { ContentMetadataModule } from './content-metadata/content-metadata.module'; +import { PermissionManagerModule } from './permission-manager/permission-manager.module'; @NgModule({ imports: [ @@ -57,7 +58,8 @@ import { ContentMetadataModule } from './content-metadata/content-metadata.modul ContentMetadataModule, DialogModule, FolderDirectiveModule, - ContentDirectiveModule + ContentDirectiveModule, + PermissionManagerModule ], providers: [ { @@ -84,7 +86,8 @@ import { ContentMetadataModule } from './content-metadata/content-metadata.modul ContentMetadataModule, DialogModule, FolderDirectiveModule, - ContentDirectiveModule + ContentDirectiveModule, + PermissionManagerModule ] }) export class ContentModule { diff --git a/lib/content-services/document-list/services/document-list.service.ts b/lib/content-services/document-list/services/document-list.service.ts index 14890826c3..45a6d4cf19 100644 --- a/lib/content-services/document-list/services/document-list.service.ts +++ b/lib/content-services/document-list/services/document-list.service.ts @@ -50,7 +50,7 @@ export class DocumentListService { let params: any = { includeSource: true, - include: ['path', 'properties', 'allowableOperations'] + include: ['path', 'properties', 'allowableOperations', 'permissions'] }; if (folder) { @@ -127,7 +127,7 @@ export class DocumentListService { getFolderNode(nodeId: string): Promise { let opts: any = { includeSource: true, - include: ['path', 'properties', 'allowableOperations'] + include: ['path', 'properties', 'allowableOperations', 'permissions'] }; let nodes: any = this.apiService.getInstance().nodes; diff --git a/lib/content-services/i18n/en.json b/lib/content-services/i18n/en.json index da1c7bb068..cc1df95d16 100644 --- a/lib/content-services/i18n/en.json +++ b/lib/content-services/i18n/en.json @@ -206,5 +206,13 @@ "CLOSE": "CLOSE", "COPY-LINK": "COPY LINK" } + }, + "PERMISSION_MANAGER": { + "PERMISSION_DISPLAY": { + "INHERITED" : "Inherited", + "AUTHORITY_ID" : "Authority ID", + "NAME": "Name", + "LOCALLY_SET" : "Locally set" + } } } diff --git a/lib/content-services/index.ts b/lib/content-services/index.ts index 454cd8b0dc..fd6832da53 100644 --- a/lib/content-services/index.ts +++ b/lib/content-services/index.ts @@ -31,6 +31,7 @@ export * from './dialogs/dialog.module'; export * from './folder-directive/folder-directive.module'; export * from './content-metadata/content-metadata.module'; export * from './directives/content-directive.module'; +export * from './permission-manager/permission-manager.module'; export * from './directives'; export * from './social'; @@ -46,3 +47,4 @@ export * from './content-node-selector'; export * from './dialogs'; export * from './folder-directive'; export * from './content-metadata'; +export * from './permission-manager'; diff --git a/lib/content-services/mock/permission-list.component.mock.ts b/lib/content-services/mock/permission-list.component.mock.ts new file mode 100644 index 0000000000..ab05d6fb9a --- /dev/null +++ b/lib/content-services/mock/permission-list.component.mock.ts @@ -0,0 +1,185 @@ +/*! + * @license + * Copyright 2016 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. + */ + +export const fakeNodeWithPermissions: any = { + 'aspectNames': [ + 'cm:auditable', + 'cm:taggable', + 'cm:author', + 'cm:titled', + 'app:uifacets' + ], + 'createdAt': '2017-11-16T16:29:38.638+0000', + 'isFolder': true, + 'isFile': false, + 'createdByUser': { + 'id': 'System', + 'displayName': 'System' + }, + 'modifiedAt': '2018-03-21T03:17:58.783+0000', + 'permissions': { + 'inherited': [ + { + 'authorityId': 'guest', + 'name': 'Read', + 'accessStatus': 'ALLOWED' + }, + { + 'authorityId': 'GROUP_EVERYONE', + 'name': 'Read', + 'accessStatus': 'ALLOWED' + } + ], + 'locallySet': [ + { + 'authorityId': 'GROUP_EVERYONE', + 'name': 'Contributor', + 'accessStatus': 'ALLOWED' + } + ], + 'settable': [ + 'Contributor', + 'Collaborator', + 'Coordinator', + 'Editor', + 'Consumer' + ], + 'isInheritanceEnabled': true + }, + 'modifiedByUser': { + 'id': 'admin', + 'displayName': 'PedroH Hernandez' + }, + 'name': 'test', + 'id': 'f472543f-7218-403d-917b-7a5861257244', + 'nodeType': 'cm:folder', + 'properties': { + 'cm:title': 'test', + 'cm:author': 'yagud', + 'cm:taggable': [ + 'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409' + ], + 'cm:description': 'sleepery', + 'app:icon': 'space-icon-default' + } +}; + +export const fakeNodeInheritedOnly: any = { + 'aspectNames': [ + 'cm:auditable', + 'cm:taggable', + 'cm:author', + 'cm:titled', + 'app:uifacets' + ], + 'createdAt': '2017-11-16T16:29:38.638+0000', + 'isFolder': true, + 'isFile': false, + 'createdByUser': { + 'id': 'System', + 'displayName': 'System' + }, + 'modifiedAt': '2018-03-21T03:17:58.783+0000', + 'permissions': { + 'inherited': [ + { + 'authorityId': 'guest', + 'name': 'Read', + 'accessStatus': 'ALLOWED' + }, + { + 'authorityId': 'GROUP_EVERYONE', + 'name': 'Read', + 'accessStatus': 'ALLOWED' + } + ], + 'settable': [ + 'Contributor', + 'Collaborator', + 'Coordinator', + 'Editor', + 'Consumer' + ], + 'isInheritanceEnabled': true + }, + 'modifiedByUser': { + 'id': 'admin', + 'displayName': 'PedroH Hernandez' + }, + 'name': 'test', + 'id': 'f472543f-7218-403d-917b-7a5861257244', + 'nodeType': 'cm:folder', + 'properties': { + 'cm:title': 'test', + 'cm:author': 'yagud', + 'cm:taggable': [ + 'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409' + ], + 'cm:description': 'sleepery', + 'app:icon': 'space-icon-default' + } +}; +export const fakeNodeWithOnlyLocally: any = { + 'aspectNames': [ + 'cm:auditable', + 'cm:taggable', + 'cm:author', + 'cm:titled', + 'app:uifacets' + ], + 'createdAt': '2017-11-16T16:29:38.638+0000', + 'isFolder': true, + 'isFile': false, + 'createdByUser': { + 'id': 'System', + 'displayName': 'System' + }, + 'modifiedAt': '2018-03-21T03:17:58.783+0000', + 'permissions': { + 'locallySet': [ + { + 'authorityId': 'GROUP_EVERYONE', + 'name': 'Contributor', + 'accessStatus': 'ALLOWED' + } + ], + 'settable': [ + 'Contributor', + 'Collaborator', + 'Coordinator', + 'Editor', + 'Consumer' + ], + 'isInheritanceEnabled': true + }, + 'modifiedByUser': { + 'id': 'admin', + 'displayName': 'PedroH Hernandez' + }, + 'name': 'test', + 'id': 'f472543f-7218-403d-917b-7a5861257244', + 'nodeType': 'cm:folder', + 'properties': { + 'cm:title': 'test', + 'cm:author': 'yagud', + 'cm:taggable': [ + 'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409' + ], + 'cm:description': 'sleepery', + 'app:icon': 'space-icon-default' + } +}; diff --git a/lib/content-services/permission-manager/components/permission-display/permission-list.component.html b/lib/content-services/permission-manager/components/permission-display/permission-list.component.html new file mode 100644 index 0000000000..ed87390d6c --- /dev/null +++ b/lib/content-services/permission-manager/components/permission-display/permission-list.component.html @@ -0,0 +1,28 @@ +
+ + + + + + + + + + {{'PERMISSION_MANAGER.PERMISSION_DISPLAY.INHERITED' | translate}} + + + + + {{'PERMISSION_MANAGER.PERMISSION_DISPLAY.LOCALLY_SET' | translate}} + + + + + + + +
+ diff --git a/lib/content-services/permission-manager/components/permission-display/permission-list.component.scss b/lib/content-services/permission-manager/components/permission-display/permission-list.component.scss new file mode 100644 index 0000000000..348cd0219b --- /dev/null +++ b/lib/content-services/permission-manager/components/permission-display/permission-list.component.scss @@ -0,0 +1,15 @@ +@mixin adf-permission-list-theme($theme) { + + .adf{ + + &-display-permission-container { + display: flex; + justify-content: space-around; + } + + &-datatable-permission { + display: flex; + flex-basis: 38%; + } + } +} diff --git a/lib/content-services/permission-manager/components/permission-display/permission-list.component.spec.ts b/lib/content-services/permission-manager/components/permission-display/permission-list.component.spec.ts new file mode 100644 index 0000000000..ad611ba8b5 --- /dev/null +++ b/lib/content-services/permission-manager/components/permission-display/permission-list.component.spec.ts @@ -0,0 +1,81 @@ +/*! + * @license + * Copyright 2016 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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { PermissionListComponent } from './permission-list.component'; +import { NodesApiService } from '@alfresco/adf-core'; +import { Observable } from 'rxjs/Observable'; +import { fakeNodeWithPermissions, fakeNodeInheritedOnly, fakeNodeWithOnlyLocally} from '../../../mock/permission-list.component.mock'; + +describe('PermissionDisplayComponent', () => { + + let fixture: ComponentFixture; + let component: PermissionListComponent; + let element: HTMLElement; + let nodeService: NodesApiService; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ + PermissionListComponent + ], + providers: [NodesApiService] + }).compileComponents().then(() => { + fixture = TestBed.createComponent(PermissionListComponent); + component = fixture.componentInstance; + element = fixture.nativeElement; + nodeService = TestBed.get(NodesApiService); + }); + })); + + afterEach(async(() => { + fixture.destroy(); + TestBed.resetTestingModule(); + })); + + it('should be able to render the component', async() => { + fixture.detectChanges(); + expect(element.querySelector('#adf-permission-display-container')).not.toBeNull(); + }); + + it('should show the node permissions', async() => { + component.nodeId = 'fake-node-id'; + spyOn(nodeService, 'getNode').and.returnValue(Observable.of(fakeNodeWithPermissions)); + fixture.detectChanges(); + expect(element.querySelector('#adf-permission-display-container')).not.toBeNull(); + expect(element.querySelectorAll('.adf-datatable-row').length).toBe(4); + }); + + it('should show inherited label for inherited permissions', async() => { + component.nodeId = 'fake-node-id'; + spyOn(nodeService, 'getNode').and.returnValue(Observable.of(fakeNodeInheritedOnly)); + fixture.detectChanges(); + expect(element.querySelector('#adf-permission-display-container')).not.toBeNull(); + expect(element.querySelector('#adf-permission-inherited-label')).toBeDefined(); + expect(element.querySelector('#adf-permission-inherited-label')).not.toBeNull(); + }); + + it('should show locally set label for locally set permissions', async() => { + component.nodeId = 'fake-node-id'; + spyOn(nodeService, 'getNode').and.returnValue(Observable.of(fakeNodeWithOnlyLocally)); + fixture.detectChanges(); + expect(element.querySelector('#adf-permission-display-container')).not.toBeNull(); + expect(element.querySelector('#adf-permission-locallyset-label')).toBeDefined(); + expect(element.querySelector('#adf-permission-locallyset-label')).not.toBeNull(); + }); + +}); diff --git a/lib/content-services/permission-manager/components/permission-display/permission-list.component.ts b/lib/content-services/permission-manager/components/permission-display/permission-list.component.ts new file mode 100644 index 0000000000..df154ccd6f --- /dev/null +++ b/lib/content-services/permission-manager/components/permission-display/permission-list.component.ts @@ -0,0 +1,64 @@ +/*! + * @license + * Copyright 2016 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 { Component, ViewEncapsulation, Input, OnInit } from '@angular/core'; +import { NodesApiService } from '@alfresco/adf-core'; +import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { PermissionDisplayModel } from '../../models/permission.model'; + +@Component({ + selector: 'adf-permission-list', + templateUrl: './permission-list.component.html', + styleUrls: ['./permission-list.component.scss'], + encapsulation: ViewEncapsulation.None +}) +export class PermissionListComponent implements OnInit { + + @Input() + nodeId: string = ''; + + permissionList: PermissionDisplayModel[]; + + constructor(private nodeService: NodesApiService) { + + } + + ngOnInit() { + this.nodeService.getNode(this.nodeId).subscribe((node: MinimalNodeEntryEntity) => { + this.permissionList = this.getPermissionList(node); + }); + } + + private getPermissionList(node: MinimalNodeEntryEntity): PermissionDisplayModel[] { + let allPermissions: PermissionDisplayModel[] = []; + if (node.permissions.locallySet) { + node.permissions.locallySet.map((element) => { + let permission = new PermissionDisplayModel(element); + allPermissions.push(permission); + }); + } + if (node.permissions.inherited) { + node.permissions.inherited.map((element) => { + let permissionInherited = new PermissionDisplayModel(element); + permissionInherited.isInherited = true; + allPermissions.push(permissionInherited); + }); + } + return allPermissions; + } + +} diff --git a/lib/content-services/permission-manager/index.ts b/lib/content-services/permission-manager/index.ts new file mode 100644 index 0000000000..4c6ac1d58f --- /dev/null +++ b/lib/content-services/permission-manager/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2016 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. + */ + +export * from './public-api'; diff --git a/lib/content-services/permission-manager/models/permission.model.ts b/lib/content-services/permission-manager/models/permission.model.ts new file mode 100644 index 0000000000..41767a7d4a --- /dev/null +++ b/lib/content-services/permission-manager/models/permission.model.ts @@ -0,0 +1,34 @@ +/*! + * @license + * Copyright 2016 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. + */ + +export class PermissionDisplayModel { + accessStatus: string; + authorityId: string; + name: string; + isInherited: boolean = false; + icon: string; + + constructor(obj?: any) { + if (obj) { + this.accessStatus = obj.accessStatus; + this.authorityId = obj.authorityId; + this.name = obj.name; + this.isInherited = obj.isInherited; + this.icon = obj.icon ? obj.icon : 'lock_open'; + } + } +} diff --git a/lib/content-services/permission-manager/permission-manager.module.ts b/lib/content-services/permission-manager/permission-manager.module.ts new file mode 100644 index 0000000000..1088f7a688 --- /dev/null +++ b/lib/content-services/permission-manager/permission-manager.module.ts @@ -0,0 +1,43 @@ +/*! + * @license + * Copyright 2016 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 { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { TranslateModule } from '@ngx-translate/core'; +import { MaterialModule } from '../material.module'; +import { PermissionListComponent } from './components/permission-display/permission-list.component'; +import { DataTableModule, DataColumnModule } from '@alfresco/adf-core'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + ReactiveFormsModule, + MaterialModule, + TranslateModule, + DataTableModule, + DataColumnModule + ], + declarations: [ + PermissionListComponent + ], + exports: [ + PermissionListComponent + ] +}) +export class PermissionManagerModule {} diff --git a/lib/content-services/permission-manager/public-api.ts b/lib/content-services/permission-manager/public-api.ts new file mode 100644 index 0000000000..d795356379 --- /dev/null +++ b/lib/content-services/permission-manager/public-api.ts @@ -0,0 +1,20 @@ +/*! + * @license + * Copyright 2016 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. + */ + + export * from './components/permission-display/permission-list.component'; + + export * from './models/permission.model'; diff --git a/lib/content-services/styles/_index.scss b/lib/content-services/styles/_index.scss index 550f533880..256f56c9f6 100644 --- a/lib/content-services/styles/_index.scss +++ b/lib/content-services/styles/_index.scss @@ -14,6 +14,7 @@ @import '../content-node-selector/content-node-selector.component'; @import '../content-metadata/content-metadata.module'; +@import '../permission-manager/components/permission-display/permission-list.component'; @mixin adf-content-services-theme($theme) { @include adf-breadcrumb-theme($theme); @@ -28,4 +29,5 @@ @include adf-dialog-theme($theme); @include adf-content-node-selector-dialog-theme($theme) ; @include adf-content-metadata-module-theme($theme); + @include adf-permission-list-theme($theme); } diff --git a/lib/core/services/nodes-api.service.ts b/lib/core/services/nodes-api.service.ts index b53fe3d52d..98abaddf5e 100644 --- a/lib/core/services/nodes-api.service.ts +++ b/lib/core/services/nodes-api.service.ts @@ -46,7 +46,7 @@ export class NodesApiService { getNode(nodeId: string, options: any = {}): Observable { const { nodesApi, handleError, getEntryFromEntity } = this; const defaults = { - include: [ 'path', 'properties', 'allowableOperations' ] + include: [ 'path', 'properties', 'allowableOperations', 'permissions' ] }; const queryOptions = Object.assign(defaults, options); const promise = nodesApi @@ -68,7 +68,7 @@ export class NodesApiService { const defaults = { maxItems: this.preferences.paginationSize, skipCount: 0, - include: [ 'path', 'properties', 'allowableOperations' ] + include: [ 'path', 'properties', 'allowableOperations', 'permissions' ] }; const queryOptions = Object.assign(defaults, options); const promise = nodesApi