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:

MetacatHandler.java
658 658
            if (inlineDataId == null || inlineDataId.equals("")) {
659 659
                throw new Exception("You didn't specify requested inlinedataid"); }
660 660
            
661
            // check for permission
662
            docId = 
663
                DocumentUtil.getDocIdWithoutRevFromInlineDataID(inlineDataId);
661
            // check for permission, use full docid with revision
662
            docId = DocumentUtil.getDocIdFromInlineDataID(inlineDataId);
663

  
664 664
            PermissionController controller = new PermissionController(docId);
665 665
            // check top level read permission
666 666
            if (!controller.hasPermission(user, groups,
......
672 672
                //check data access level
673 673
                try {
674 674
                    Hashtable<String,String> unReadableInlineDataList =
675
                            PermissionController.getUnReadableInlineDataIdList(docId,
676
                            user, groups, false);
677
                    String inlineDataIdWithoutRev = DocumentUtil.getInlineDataIdWithoutRev(inlineDataId);
678
                    if (unReadableInlineDataList.containsValue(inlineDataIdWithoutRev)) {
675
                            PermissionController.getUnReadableInlineDataIdList(docId, user, groups);
676
                    if (unReadableInlineDataList.containsValue(inlineDataId)) {
679 677
                        throw new Exception("User " + user
680 678
                                + " doesn't have permission " + " to read inlinedata "
681 679
                                + inlineDataId);
......
1851 1849
                  // handle inserts
1852 1850
                  try {
1853 1851
                	// create the system metadata  
1854
                    sysMeta = SystemMetadataFactory.createSystemMetadata(newdocid, true);
1852
                    sysMeta = SystemMetadataFactory.createSystemMetadata(newdocid, false);
1855 1853
                    
1856 1854
                    // save it to the map
1857 1855
                    HazelcastService.getInstance().getSystemMetadataMap().put(sysMeta.getIdentifier(), sysMeta);
......
2994 2992
                                    username, groupnames);
2995 2993
                            
2996 2994
                            // generate system metadata about the doc
2997
                            SystemMetadata sm = SystemMetadataFactory.createSystemMetadata(docid, true);
2995
                            SystemMetadata sm = SystemMetadataFactory.createSystemMetadata(docid, false);
2998 2996
							
2999 2997
					        // manage it in the store
3000 2998
                            HazelcastService.getInstance().getSystemMetadataMap().put(sm.getIdentifier(), sm);

Also available in: Unified diff