Project

General

Profile

« Previous | Next » 

Revision 9272

Added by Jing Tao almost 9 years ago

The method of setReplicationstatus can be called by CNs and MNs.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
311 311
			  
312 312
			// check permissions
313 313
			// TODO: is this necessary?
314
			List<Node> nodeList = D1Client.getCN().listNodes().getNodeList();
314
			/*List<Node> nodeList = D1Client.getCN().listNodes().getNodeList();
315 315
			boolean isAllowed = ServiceMethodRestrictionUtil.isMethodAllowed(session.getSubject(), nodeList, "CNReplication", "deleteReplicationMetadata");
316 316
			if (!isAllowed) {
317 317
				throw new NotAuthorized("4881", "Caller is not authorized to deleteReplicationMetadata");
318
			}
318
			}*/
319 319
			  
320 320
			// delete the replica from the given node
321 321
			// CSJ: use CN.delete() to truly delete a replica, semantically
......
771 771
	  // cannot be called by public
772 772
	  if (session == null) {
773 773
		  throw new NotAuthorized("4720", "Session cannot be null");
774
	  } else {
774
	  } 
775
	  
776
	  /*else {
775 777
	      if(!isCNAdmin(session)) {
776 778
              throw new NotAuthorized("4720", "The client -"+ session.getSubject().getValue()+ "is not a CN and is not authorized for setting the replication status of the object "+pid.getValue());
777 779
        }
778
	  }
780
	  }*/
779 781
	  
780 782
	// do we have a valid pid?
781 783
      if (pid == null || pid.getValue().trim().equals("")) {
......
881 883

  
882 884
              if ( !allowed ) {
883 885
                  //check for CN admin access
884
                  allowed = isAuthorized(session, pid, Permission.WRITE);
886
                  //allowed = isAuthorized(session, pid, Permission.WRITE);
887
                  allowed = isCNAdmin(session);
885 888
                  
886 889
              }              
887 890
              
888 891
              if ( !allowed ) {
889 892
                  String msg = "The subject identified by "
890 893
                          + subject.getValue()
891
                          + " does not have permission to set the replication status for "
894
                          + " is not a CN or MN, and does not have permission to set the replication status for "
892 895
                          + "the replica identified by "
893 896
                          + targetNode.getValue() + ".";
894 897
                  logMetacat.info(msg);

Also available in: Unified diff