From 67128ddfb243cd3ce6a7fd86518608b2a4789713 Mon Sep 17 00:00:00 2001 From: rkv Date: Tue, 16 Apr 2013 16:59:17 +0000 Subject: [PATCH] Condition in canDemote is simplified. --- .../src/org/splat/som/DocumentRights.java | 21 ++++++------------- .../src/org/splat/som/StudyRights.java | 21 ++++++------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/Workspace/Siman-Common/src/org/splat/som/DocumentRights.java b/Workspace/Siman-Common/src/org/splat/som/DocumentRights.java index 2d0399e..571b419 100644 --- a/Workspace/Siman-Common/src/org/splat/som/DocumentRights.java +++ b/Workspace/Siman-Common/src/org/splat/som/DocumentRights.java @@ -168,21 +168,12 @@ public class DocumentRights { User approver = _cycle.getActor(ValidationStep.APPROVAL); // May be null if not approvable ProgressState mystate = _operand.value().getProgressState(); - boolean res = (((mystate != ProgressState.inDRAFT || publisher != null - || _isauthor || _user.equals(manager)) - && (publisher == null || _user.equals(publisher)) || _user - .equals(reviewer)) - - && (mystate != ProgressState.inCHECK - - || ((approver == null || _user.equals(approver) || _user - .equals(reviewer)) - - && (approver != null || _user.equals(publisher) || (reviewer == null || _user - .equals(reviewer)) - && (reviewer != null || _user.equals(manager))))) - - && (mystate == ProgressState.inCHECK || mystate == ProgressState.inDRAFT)); + boolean res = (mystate == ProgressState.inDRAFT + && (_user.equals(publisher) || _user.equals(reviewer) + || _user.equals(manager) || (reviewer == null) + && _user.equals(approver)) || mystate == ProgressState.inCHECK + && (_user.equals(approver) || _user.equals(reviewer) || (reviewer == null) + && (_user.equals(publisher) || _user.equals(manager)))); if (res) { List use = _operand.value().getRelations( diff --git a/Workspace/Siman-Common/src/org/splat/som/StudyRights.java b/Workspace/Siman-Common/src/org/splat/som/StudyRights.java index ac98a65..58191aa 100644 --- a/Workspace/Siman-Common/src/org/splat/som/StudyRights.java +++ b/Workspace/Siman-Common/src/org/splat/som/StudyRights.java @@ -216,21 +216,12 @@ public class StudyRights { User approver = _cycle.getActor(ValidationStep.APPROVAL); // May be null if not approvable ProgressState mystate = _operand.getProgressState(); - boolean res = (((mystate != ProgressState.inDRAFT || publisher != null - || _isauthor || _user.equals(manager)) - && (publisher == null || _user.equals(publisher)) || _user - .equals(reviewer)) - - && (mystate != ProgressState.inCHECK - - || ((approver == null || _user.equals(approver) || _user - .equals(reviewer)) - - && (approver != null || _user.equals(publisher) || (reviewer == null || _user - .equals(reviewer)) - && (reviewer != null || _user.equals(manager))))) - - && (mystate == ProgressState.inCHECK || mystate == ProgressState.inDRAFT)); + boolean res = (mystate == ProgressState.inDRAFT + && (_user.equals(publisher) || _user.equals(reviewer) + || _user.equals(manager) || (reviewer == null) + && _user.equals(approver)) || mystate == ProgressState.inCHECK + && (_user.equals(approver) || _user.equals(reviewer) || (reviewer == null) + && (_user.equals(publisher) || _user.equals(manager)))); return res; } -- 2.39.2