Revision 5112
Added by daigle about 15 years ago
src/edu/ucsb/nceas/metacat/client/MetacatClient.java | ||
---|---|---|
684 | 684 |
return response; |
685 | 685 |
} |
686 | 686 |
|
687 |
/** |
|
688 |
* get the access control info for a given document id. |
|
689 |
* |
|
690 |
* @param _docid the docid of the document for which the access should be applied. |
|
691 |
* |
|
692 |
* @return the metacat access xml |
|
693 |
*/ |
|
694 |
public String getAccessControl(String docid) |
|
695 |
throws InsufficientKarmaException, MetacatException,MetacatInaccessibleException { |
|
696 |
//set up properties |
|
697 |
Properties prop = new Properties(); |
|
698 |
prop.put("action", "getaccesscontrol"); |
|
699 |
prop.put("docid", docid); |
|
700 |
|
|
701 |
String response = null; |
|
702 |
try { |
|
703 |
response = sendDataForString(prop, null, null, 0); |
|
704 |
} catch (Exception e) { |
|
705 |
throw new MetacatInaccessibleException(e.getMessage()); |
|
706 |
} |
|
707 |
|
|
708 |
// Check for an error condition |
|
709 |
if (response.indexOf("<error>") != -1) { |
|
710 |
if (response.indexOf("does not have permission") != -1) { |
|
711 |
throw new InsufficientKarmaException(response); |
|
712 |
} else { |
|
713 |
throw new MetacatException(response); |
|
714 |
} |
|
715 |
} |
|
716 |
return response; |
|
717 |
} |
|
687 | 718 |
|
688 | 719 |
/** |
689 | 720 |
* set the access on an XML document in the repository. |
src/edu/ucsb/nceas/metacat/client/Metacat.java | ||
---|---|---|
220 | 220 |
throws InsufficientKarmaException, MetacatException, |
221 | 221 |
MetacatInaccessibleException; |
222 | 222 |
|
223 |
public String getAccessControl(String docid) |
|
224 |
throws InsufficientKarmaException, MetacatException,MetacatInaccessibleException; |
|
225 |
|
|
223 | 226 |
/** |
224 | 227 |
* set the access on an XML document in the repository. |
225 | 228 |
* |
... | ... | |
245 | 248 |
* reached or does not respond |
246 | 249 |
* @throws MetacatException when the metacat server generates another error |
247 | 250 |
*/ |
248 |
public String setAccess(String _docid, String _principal, String |
|
249 |
_permission, String _permType, String _permOrder ) |
|
250 |
throws InsufficientKarmaException, MetacatException, |
|
251 |
MetacatInaccessibleException; |
|
251 |
public String setAccess(String docid, String principal, String |
|
252 |
permission, String permType, String permOrder ) |
|
253 |
throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException; |
|
252 | 254 |
|
255 |
public String setAccess(String docid, String accessBlock) |
|
256 |
throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException; |
|
257 |
|
|
253 | 258 |
/** |
254 | 259 |
* When the MetacatFactory creates an instance it needs to set the |
255 | 260 |
* MetacatUrl to which connections should be made. |
Also available in: Unified diff
add getaccesscontrol and setaccess api calls