Files
alfresco-ng2-components/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.ts
Vito fabb6f4450 [ADF-2601] added permission check to info editing button (#3177)
* [ADF-2601] added permission check to info editing button

* [ADF-2601] added test for node permission check on the content metadata card

* [ADF-2601] used enum instead of string for test
2018-04-17 20:34:14 +01:00

63 lines
1.7 KiB
TypeScript

/*!
* @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, Input, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { ContentService, PermissionsEnum } from '@alfresco/adf-core';
@Component({
selector: 'adf-content-metadata-card',
templateUrl: './content-metadata-card.component.html',
styleUrls: ['./content-metadata-card.component.scss'],
encapsulation: ViewEncapsulation.None,
host: { 'class': 'adf-content-metadata-card' }
})
export class ContentMetadataCardComponent {
@Input()
node: MinimalNodeEntryEntity;
@Input()
displayEmpty: boolean = false;
@Input()
preset: string;
@Input()
readOnly = false;
@Input()
multi = false;
editable: boolean = false;
expanded: boolean = false;
constructor(private contentService: ContentService) {
}
toggleEdit(): void {
this.editable = !this.editable;
}
toggleExpanded(): void {
this.expanded = !this.expanded;
}
hasPermission() {
return this.contentService.hasPermission(this.node, PermissionsEnum.UPDATE);
}
}