Revision 5424
Added by berkley almost 14 years ago
MetacatHandler.java | ||
---|---|---|
936 | 936 |
String permission, String permissionType, String permissionOrder) |
937 | 937 |
throws Exception |
938 | 938 |
{ |
939 |
Hashtable<String,String[]> params = new Hashtable(); |
|
939 |
Hashtable<String,String[]> params = new Hashtable<String,String[]>();
|
|
940 | 940 |
params.put("principal", new String[] {principal}); |
941 | 941 |
params.put("permission", new String[] {permission}); |
942 | 942 |
params.put("permType", new String[] {permissionType}); |
... | ... | |
946 | 946 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
947 | 947 |
PrintWriter out = new PrintWriter(baos); |
948 | 948 |
handleSetAccessAction(out, params, username, null, null); |
949 |
String resp = baos.toString(); |
|
950 |
System.out.println("response from MetacatHandler.setAccess: " + resp); |
|
949 | 951 |
} |
950 | 952 |
|
951 | 953 |
/** read metadata or data from Metacat |
... | ... | |
2616 | 2618 |
String[] permOrderList = params.get("permOrder"); |
2617 | 2619 |
String[] qformatList = params.get("qformat"); |
2618 | 2620 |
String[] accessBlock = params.get("accessBlock"); |
2619 |
|
|
2620 | 2621 |
if(accessBlock != null) { |
2621 | 2622 |
if (docList == null) { |
2622 | 2623 |
errorList.addElement("MetaCatServlet.handleSetAccessAction - Doc id missing. Please check your parameter list, it should look like: " |
... | ... | |
2624 | 2625 |
outputResponse(successList, errorList, out); |
2625 | 2626 |
return; |
2626 | 2627 |
} |
2627 |
|
|
2628 | 2628 |
try { |
2629 | 2629 |
AccessControlForSingleFile accessControl = |
2630 | 2630 |
new AccessControlForSingleFile(docList[0]); |
... | ... | |
2633 | 2633 |
} catch(AccessControlException ace) { |
2634 | 2634 |
errorList.addElement("MetaCatServlet.handleSetAccessAction - access control error when setting " + |
2635 | 2635 |
"access block: " + ace.getMessage()); |
2636 |
}
|
|
2636 |
} |
|
2637 | 2637 |
outputResponse(successList, errorList, out); |
2638 | 2638 |
return; |
2639 | 2639 |
} |
... | ... | |
2686 | 2686 |
ple.printStackTrace(System.out); |
2687 | 2687 |
} |
2688 | 2688 |
} |
2689 |
|
|
2690 | 2689 |
String accessionNumber = docid; |
2691 | 2690 |
String owner = null; |
2692 | 2691 |
String publicId = null; |
... | ... | |
2707 | 2706 |
error = "User - " + username + " does not have permission to set " |
2708 | 2707 |
+ "access control for docid - " + accessionNumber; |
2709 | 2708 |
errorList.addElement(error); |
2709 |
System.out.println("user " + username + " does not have permission to set " + |
|
2710 |
"access control for docid " + accessionNumber); |
|
2710 | 2711 |
continue; |
2711 | 2712 |
} |
2712 | 2713 |
|
... | ... | |
2724 | 2725 |
error = "Could not set access control to document " + accessionNumber |
2725 | 2726 |
+ "because it is in a pakcage and it has a access file for it"; |
2726 | 2727 |
errorList.addElement(error); |
2728 |
System.out.println("this is a beta4 or 6 document so we can't set the access element."); |
|
2727 | 2729 |
continue; |
2728 | 2730 |
} |
2729 |
|
|
2730 | 2731 |
// for every principle |
2731 | 2732 |
for (int j = 0; j < principalList.length; j++) { |
2732 | 2733 |
String principal = principalList[j]; |
Also available in: Unified diff
fixed bug in access control where the sessionid was not correctly passed along so changes of privileges were not being made