mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[AAE-12501] Get username with authentication service
This commit is contained in:
@@ -87,7 +87,7 @@ export class ContentService {
|
||||
*/
|
||||
hasPermissions(node: Node, permission: PermissionsEnum | string, userId?: string): boolean {
|
||||
let hasPermissions = false;
|
||||
userId = userId ?? this.apiService.getInstance().getEcmUsername();
|
||||
userId = userId ?? this.authService.getEcmUsername();
|
||||
|
||||
const permissions = [...(node.permissions?.locallySet || []), ...(node.permissions?.inherited || [])]
|
||||
.filter((currentPermission) => currentPermission.authorityId === userId);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AuthenticationService } from '@alfresco/adf-core';
|
||||
import moment, { Moment } from 'moment';
|
||||
|
||||
@Injectable({
|
||||
@@ -25,7 +25,7 @@ import moment, { Moment } from 'moment';
|
||||
})
|
||||
export class LockService {
|
||||
|
||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
||||
constructor(private authService: AuthenticationService) {
|
||||
}
|
||||
|
||||
isLocked(node: Node): boolean {
|
||||
@@ -34,7 +34,7 @@ export class LockService {
|
||||
if (this.isReadOnlyLock(node)) {
|
||||
isLocked = !this.isLockExpired(node);
|
||||
} else if (this.isLockOwnerAllowed(node)) {
|
||||
isLocked = this.alfrescoApiService.getInstance().getEcmUsername() !== node.properties['cm:lockOwner'].id;
|
||||
isLocked = this.authService.getEcmUsername() !== node.properties['cm:lockOwner'].id;
|
||||
if (this.isLockExpired(node)) {
|
||||
isLocked = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user