public ManagerAccessForm(ManagerAccessConfirmation managerAccessConfirmation) : this() { if (managerAccessConfirmation == null) { throw new ArgumentNullException("managerAccessConfirmation"); } this.operationId = (PosisOperations)managerAccessConfirmation.Operation; }
private void HandleManagerAccessInteraction(InteractionRequestedEventArgs e) { if (e == null) { throw new ArgumentNullException("InteractionRequestedEventArgs"); } ManagerAccessConfirmation context = (ManagerAccessConfirmation)e.Context; ManagerAccessConfirmation results = InvokeInteraction <ManagerAccessConfirmation, ManagerAccessConfirmation>("ManagerAccessForm", context, true); if (results != null) { context.Confirmed = results.Confirmed; context.OperatorId = results.OperatorId; } }
/// <summary> /// Verifies the operation access. /// </summary> /// <param name="operatorID">The operator ID.</param> /// <param name="operation">The operation.</param> /// <param name="transactionId">The transaction id.</param> /// <returns> /// /// True if operator has access, false otherwise. /// </returns> private bool VerifyOperationAccess(string operatorID, PosisOperations operation, string transactionId) { bool result = true; IUserAccessSystem userAccess = Application.BusinessLogic.UserAccessSystem; if (!userAccess.UserHasAccess(operatorID, operation)) { ManagerAccessConfirmation managerAccessInteraction = new ManagerAccessConfirmation() { Operation = (int)operation }; // If a manager key is already in "Supervisor" position then don't prompt manager access. if (Application.Services.Peripherals.KeyLock.SupervisorPosition()) { managerAccessInteraction.Confirmed = true; } else { InteractionRequestedEventArgs request = new InteractionRequestedEventArgs(managerAccessInteraction, () => { }); Application.Services.Interaction.InteractionRequest(request); } if (managerAccessInteraction.Confirmed) { string authorizedBy = string.IsNullOrWhiteSpace(managerAccessInteraction.OperatorId) // If no operator ID is found then key was used ? "Keylock" : managerAccessInteraction.OperatorId; // Log manager authorizations to audit log ApplicationLog.WriteAuditEntry("LogOn:VerifyOperationAccess()", string.Format("Manager '{0}' authorized the operation '{1}' for transaction '{2}'", authorizedBy, operation, transactionId)); } else { ApplicationLog.WriteAuditEntry("LogOn:VerifyOperationAccess()", string.Format("Manager authorization either failed or was cancelled for operation '{0}'.", operation)); Application.Services.Dialog.ShowMessage(3540, MessageBoxButtons.OK, MessageBoxIcon.Stop); result = false; } } return(result); }