Project

General

Profile

« Previous | Next » 

Revision 6744

refactor Metacat access handling to be on a per-revision basis so that it more closely aligns with the DataONE approach
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5560

View differences:

ClientViewHelper.java
15 15
import com.oreilly.servlet.multipart.Part;
16 16

  
17 17
import edu.ucsb.nceas.metacat.DocInfoHandler;
18
import edu.ucsb.nceas.metacat.IdentifierManager;
19
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
18 20
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlException;
19 21
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile;
20 22
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
......
505 507
    }
506 508
    
507 509
    private String setPublicAccess(String permissionType, String metaDocId, Stack docIdStack)
508
    throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException, AccessControlException{
510
    throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException, AccessControlException, McdbDocNotFoundException{
509 511
        String                      result = " for Documents ";
510 512
        String                      docId, lst = metaDocId, permOrder;
511 513
        
......
534 536
     * Second, remove all access rules of the user public, then add the new rules. 
535 537
     */
536 538
    private void setPublicReadAccess(String permissionType, String docid) 
537
        throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException, AccessControlException{
539
        throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException, AccessControlException, McdbDocNotFoundException{
538 540
      String originalAccessBlock = getMetacatClient().getAccessControl(docid);
539 541
      Vector<XMLAccessDAO> accessList = parseAccessXMLBlock(docid, originalAccessBlock);
540 542
      if(accessList != null  && !accessList.isEmpty()) {
......
607 609
     * Populate xmlAccessDAO object with the some parameters.
608 610
     */
609 611
    private XMLAccessDAO generateXMLAccessDAO(String docid, String principalName,
610
        String permission, String permType, String permOrder) {
611
      String identifier = DocumentUtil.getDocIdFromString(docid);
612
        String permission, String permType, String permOrder) throws McdbDocNotFoundException {
613
      String localId = DocumentUtil.getDocIdFromString(docid);
614
      int rev = DocumentUtil.getRevisionFromAccessionNumber(docid);
615
      String identifier = IdentifierManager.getInstance().getGUID(localId, rev);
612 616
      XMLAccessDAO xmlAccessDAO = new XMLAccessDAO();
613
      xmlAccessDAO.setDocId(identifier);
617
      xmlAccessDAO.setGuid(identifier);
614 618
      xmlAccessDAO.setPrincipalName(principalName);
615 619
      xmlAccessDAO.setPermission(Integer.valueOf(AccessControlList.intValue(permission)).longValue());
616 620
      xmlAccessDAO.setPermType(permType);

Also available in: Unified diff