Salome HOME
- Set up-to date functionality is implemented;
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / som / DocumentRights.java
index b757a49cd5b7682b75de2afb1839645b49b6f05f..9e9d7242092e5d7c87b5ebeb29374b75eee4ff0a 100644 (file)
@@ -99,7 +99,8 @@ public class DocumentRights {
         * @see Publication#accept()
         */
        public boolean canAccept() {
-               return _isauthor && _operand.isOutdated();
+               return _isauthor && ServiceLocatorImpl.getInstance()
+                               .getPublicationService().canBeActualized(_operand);
        }
 
        /**
@@ -113,7 +114,8 @@ public class DocumentRights {
        public boolean canApprove() {
                User approver = _cycle.getActor(ValidationStep.APPROVAL); // May be null if not approvable
                boolean res = (_user.equals(approver))
-                               && (_operand.getProgressState() == ProgressState.inCHECK);
+                               && (_operand.getProgressState() == ProgressState.inCHECK)
+                               && !_operand.isOutdated();
                if (res) {
                        List<Relation> use = _operand.value().getRelations(
                                        UsesRelation.class);
@@ -230,6 +232,9 @@ public class DocumentRights {
                User manager = _operand.getOwnerStudy().getAuthor();
                User publisher = _cycle.getActor(ValidationStep.PROMOTION); // Null if the default users are involved
 
+               if(_operand.isOutdated()) {
+                       return false;
+               }
                if (_operand.getProgressState() != ProgressState.inWORK) {
                        if (_operand.getProgressState() == ProgressState.inDRAFT) {
                                return canReview();
@@ -355,7 +360,7 @@ public class DocumentRights {
        public boolean canReview() {
                User reviewer = _cycle.getActor(ValidationStep.REVIEW); // May be null if not reviewable
 
-               if (!_user.equals(reviewer)) {
+               if (!_user.equals(reviewer) || _operand.isOutdated()) {
                        return false;
                }
                if (_operand.getProgressState() != ProgressState.inDRAFT) {