mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
DocumentList - Check permissions on delete folder/file (#1808)
* Add check permission on delete folder/file * Provide a way to disable the action when if there is no permission * Improve the code using the external permission inside the folder/document action service * Add basic documentation. - How disable the button when the permission is missing - How to show a notification message when the permission is missing * Resize the image * Change the value to true for demo purpose * Update folder-actions.service.ts * Update document-actions.service.ts
This commit is contained in:
committed by
Mario Romano
parent
ab3d18e5c1
commit
f6102dfc07
@@ -20,6 +20,8 @@ export class ContentActionModel {
|
||||
title: string;
|
||||
handler: ContentActionHandler;
|
||||
target: string;
|
||||
permission: string;
|
||||
disableWithNoPermission: boolean;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
@@ -27,12 +29,14 @@ export class ContentActionModel {
|
||||
this.title = obj.title;
|
||||
this.handler = obj.handler;
|
||||
this.target = obj.target;
|
||||
this.permission = obj.permission;
|
||||
this.disableWithNoPermission = obj.disableWithNoPermission;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface ContentActionHandler {
|
||||
(obj: any, target?: any): any;
|
||||
(obj: any, target?: any, permission?: string): any;
|
||||
}
|
||||
|
||||
export class DocumentActionModel extends ContentActionModel {
|
||||
|
@@ -0,0 +1,30 @@
|
||||
/*!
|
||||
* @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 PermissionModel {
|
||||
type: string;
|
||||
action: string;
|
||||
permission: string;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.type = obj.type || null;
|
||||
this.action = obj.action || null;
|
||||
this.permission = obj.permission || null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user