mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2995] Permissions - Consumer should be able to upload a new version for his file on a private site (#3326)
* check node permission instead of parent * tests
This commit is contained in:
committed by
Eugenio Romano
parent
35ee120d5c
commit
374c5a3fed
@@ -23,6 +23,7 @@ import {
|
||||
Component, EventEmitter, forwardRef, Input,
|
||||
OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { PermissionModel } from '../../document-list/models/permissions.model';
|
||||
import 'rxjs/add/observable/throw';
|
||||
@@ -61,7 +62,7 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang
|
||||
|
||||
private hasPermission: boolean = false;
|
||||
|
||||
private permissionValue: Subject<boolean> = new Subject<boolean>();
|
||||
protected permissionValue: Subject<boolean> = new Subject<boolean>();
|
||||
|
||||
constructor(protected uploadService: UploadService,
|
||||
private contentService: ContentService,
|
||||
@@ -118,9 +119,13 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang
|
||||
};
|
||||
|
||||
this.contentService.getNode(this.rootFolderId, opts).subscribe(
|
||||
res => this.permissionValue.next(this.contentService.hasPermission(res.entry, PermissionsEnum.CREATE)),
|
||||
res => this.permissionValue.next(this.nodeHasPermission(res.entry, PermissionsEnum.CREATE)),
|
||||
error => this.error.emit(error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
nodeHasPermission(node: MinimalNodeEntryEntity, permission: PermissionsEnum | string): boolean {
|
||||
return this.contentService.hasPermission(node, permission);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user