mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5165] - added involved user for task (#5985)
Co-authored-by: Vito Albano <vitoalbano@Vitos-MacBook-Pro.local>
This commit is contained in:
@@ -28,7 +28,7 @@ import {
|
|||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { TaskDetailsModel } from '../../models/task-details.model';
|
import { TaskDetailsModel } from '../../models/task-details.model';
|
||||||
import { TaskListService } from '../../services/tasklist.service';
|
import { TaskListService } from '../../services/tasklist.service';
|
||||||
import { UserRepresentation } from '@alfresco/js-api';
|
import { UserRepresentation, LightUserRepresentation } from '@alfresco/js-api';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { ProcessFormRenderingService } from '../../../form/process-form-rendering.service';
|
import { ProcessFormRenderingService } from '../../../form/process-form-rendering.service';
|
||||||
|
|
||||||
@@ -281,12 +281,29 @@ export class TaskFormComponent implements OnInit {
|
|||||||
if (this.isCandidateMember()) {
|
if (this.isCandidateMember()) {
|
||||||
readOnlyForm = this.internalReadOnlyForm || !this.isAssignedToMe();
|
readOnlyForm = this.internalReadOnlyForm || !this.isAssignedToMe();
|
||||||
} else {
|
} else {
|
||||||
readOnlyForm = this.internalReadOnlyForm || !(this.isAssignedToMe() || (this.canInitiatorComplete() && this.isProcessInitiator()));
|
readOnlyForm = this.internalReadOnlyForm || !(this.isAssignedToMe() || this.canCurrentUserAsInitiatorComplete() || this.isCurrentUserInvolved());
|
||||||
}
|
}
|
||||||
|
|
||||||
return readOnlyForm;
|
return readOnlyForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isCurrentUserInvolved(): boolean {
|
||||||
|
let isInvolved = false;
|
||||||
|
if (this.taskDetails.involvedPeople && this.currentLoggedUser) {
|
||||||
|
const userInvolved = this.taskDetails.involvedPeople.find(
|
||||||
|
(involvedUser: LightUserRepresentation) =>
|
||||||
|
involvedUser.email.toLocaleLowerCase() === this.currentLoggedUser.email.toLocaleLowerCase() ||
|
||||||
|
involvedUser.id + '' === this.currentLoggedUser.externalId
|
||||||
|
);
|
||||||
|
isInvolved = !!userInvolved;
|
||||||
|
}
|
||||||
|
return isInvolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
canCurrentUserAsInitiatorComplete(): boolean {
|
||||||
|
return this.canInitiatorComplete() && this.isProcessInitiator();
|
||||||
|
}
|
||||||
|
|
||||||
isProcessInitiator(): boolean {
|
isProcessInitiator(): boolean {
|
||||||
return this.currentLoggedUser && ( this.currentLoggedUser.id === +this.taskDetails.processInstanceStartUserId);
|
return this.currentLoggedUser && ( this.currentLoggedUser.id === +this.taskDetails.processInstanceStartUserId);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user