remm 01/06/08 17:15:21
Modified: src/webdav/client/src/org/apache/webdav/lib/methods
AclMethod.java
Log:
- support for the special principals as well as for the normal href
- write the namespace as a real namespace declaration using the improved
XMLprinter
Patch submitted by Dirk Verbeeck <dirk.verbeeck at the-ecorp.com>
Revision Changes Path
1.2 +23 -7
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/AclMethod.java
Index: AclMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/AclMethod.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AclMethod.java 2001/05/22 05:35:49 1.1
+++ AclMethod.java 2001/06/09 00:15:20 1.2
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/AclMethod.java,v
1.1 2001/05/22 05:35:49 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2001/05/22 05:35:49 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/AclMethod.java,v
1.2 2001/06/09 00:15:20 remm Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/06/09 00:15:20 $
*
* ====================================================================
*
@@ -85,6 +85,7 @@
* ACL Method.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
+ * @author Dirk Verbeeck
*/
public class AclMethod
extends HttpMethodBase {
@@ -182,7 +183,24 @@
printer.writeElement("D", null, "principal",
XMLPrinter.OPENING);
- printer.writeText(ace.getPrincipal());
+
+ boolean found=false;
+ String principal=ace.getPrincipal();
+ String[]
types={"all","authenticated","unauthenticated","property","self"};
+ for (int i=0; i<types.length && found==false; i++)
+ {
+ if (types[i].equals(principal)) {
+ found=true;
+ printer.writeElement("D",null,principal,
XMLPrinter.NO_CONTENT);
+ }
+ }
+ if (!found)
+ {
+ printer.writeElement("D", null, "href",
XMLPrinter.OPENING);
+ printer.writeText(ace.getPrincipal());
+ printer.writeElement("D", null, "href",
XMLPrinter.CLOSING);
+ }
+
printer.writeElement("D", null, "principal",
XMLPrinter.CLOSING);
@@ -196,9 +214,7 @@
Privilege privilege = (Privilege) privilegeList.nextElement();
printer.writeElement("D", null, "privilege",
XMLPrinter.OPENING);
- printer.writeElement
- (null, null, privilege.getNamespace()
- + privilege.getName(), XMLPrinter.NO_CONTENT);
+
printer.writeElement(null,privilege.getNamespace(),privilege.getName(),
XMLPrinter.NO_CONTENT);
printer.writeElement("D", null, "privilege",
XMLPrinter.CLOSING);
}