Project

General

Profile

« Previous | Next » 

Revision 10180

Added by Jing Tao about 7 years ago

Give the users having change-permission to archive an object which is from a v1 node.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
568 568

  
569 569
      // do we have a valid pid?
570 570
      if (pid == null || pid.getValue().trim().equals("")) {
571
          throw new ServiceFailure("4972", "The provided identifier was invalid.");
571
          throw new InvalidToken("4973", "The provided identifier was invalid.");
572 572
          
573 573
      }
574 574

  
......
586 586
	      allowed = isAuthoritativeMNodeAdmin(session, pid);
587 587
	  }
588 588
	  
589
	  //check if the session has the change permission
590
	  if(!allowed) {
591
	      try {
592
	          allowed = userHasPermission(session, pid, Permission.CHANGE_PERMISSION);
593
	      } catch (InvalidRequest e) {
594
	          throw new InvalidToken("4973","CN.archive method couldn't determine if the client has the change permssion on this pid "+pid.getValue()+ " since "+e.getMessage());
595
	      }
596
	      
597
	  }
589 598
	  if (!allowed) {
590 599
		  String msg = "The subject " + session.getSubject().getValue() + 
591
				  " is not allowed to call archive() on a Coordinating Node.";
592
		  logMetacat.info(msg);
600
				  " doesn't have the change permission to archive the object "+pid.getValue();
601
		  logMetacat.warn(msg);
593 602
		  throw new NotAuthorized("4970", msg);
594 603
	  }
595 604
	  

Also available in: Unified diff