[ADF-5165] - added involved user for task (#5985)

Co-authored-by: Vito Albano <vitoalbano@Vitos-MacBook-Pro.local>
This commit is contained in:
Vito
2020-08-13 09:02:28 +01:00
committed by GitHub
parent 268cf7af21
commit 9ec04d33d4

View File

@@ -28,7 +28,7 @@ import {
} from '@alfresco/adf-core';
import { TaskDetailsModel } from '../../models/task-details.model';
import { TaskListService } from '../../services/tasklist.service';
import { UserRepresentation } from '@alfresco/js-api';
import { UserRepresentation, LightUserRepresentation } from '@alfresco/js-api';
import { Observable } from 'rxjs';
import { ProcessFormRenderingService } from '../../../form/process-form-rendering.service';
@@ -281,12 +281,29 @@ export class TaskFormComponent implements OnInit {
if (this.isCandidateMember()) {
readOnlyForm = this.internalReadOnlyForm || !this.isAssignedToMe();
} else {
readOnlyForm = this.internalReadOnlyForm || !(this.isAssignedToMe() || (this.canInitiatorComplete() && this.isProcessInitiator()));
readOnlyForm = this.internalReadOnlyForm || !(this.isAssignedToMe() || this.canCurrentUserAsInitiatorComplete() || this.isCurrentUserInvolved());
}
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 {
return this.currentLoggedUser && ( this.currentLoggedUser.id === +this.taskDetails.processInstanceStartUserId);
}