juergen 2003/03/24 23:14:31
Modified: src/webdav/server/org/apache/slide/webdav/method
AclMethod.java
Log:
Fixed the result message of an exception and added the feature to allow user defined
privileges. I added this feature with a switch (allow_user_privileges) and switched it
off in the CVS so that the behavior does not change. (Eckehard)
Revision Changes Path
1.27 +27 -5
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java
Index: AclMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- AclMethod.java 12 Aug 2002 12:55:02 -0000 1.26
+++ AclMethod.java 25 Mar 2003 07:14:31 -0000 1.27
@@ -119,7 +119,7 @@
protected static final int PRIVILEGE_WRITE_ACL = 17;
protected static final int PRIVILEGE_GRANT_PERMISSION = 18;
protected static final int PRIVILEGE_REVOKE_PERMISSION = 19;
-
+ protected static final int PRIVILEGE_USER_DEFINED = 20;
// ----------------------------------------------------- Instance Variables
@@ -141,6 +141,7 @@
*/
protected NamespaceConfig config;
+ protected boolean allow_user_privileges = false;
// ----------------------------------------------------------- Constructors
@@ -340,6 +341,19 @@
case PRIVILEGE_REVOKE_PERMISSION:
addPermission (principal,
config.getRevokePermissionAction().getUri(), negative, inheritable);
break;
+ case PRIVILEGE_USER_DEFINED:
+ String userPrivilege = null;
+ List privileges = privilegeElement.getChildren();
+ if (privileges.size() != 1) {
+ int statusCode =
WebdavStatus.SC_INTERNAL_SERVER_ERROR;
+ sendError( statusCode,
getClass().getName()+".invalidPrivilegeElement", new
Object[]{privilegeElement.getNamespace()+":"+privilegeElement.getName()} );
+ throw new WebdavException( statusCode );
+ }
+ ListIterator iter = privileges.listIterator();
+ Element userPriv = (Element) iter.next();
+ String value = userPriv.getName();
+ addPermission (principal,
config.getDefaultAction().getUri() + "/" + value, negative, inheritable);
+ break;
default:
int statusCode = WebdavStatus.SC_INTERNAL_SERVER_ERROR;
sendError( statusCode,
getClass().getName()+".invalidPrivilegeElement", new
Object[]{privilegeElement.getNamespace()+":"+privilegeElement.getName()} );
@@ -507,9 +521,17 @@
// return PRIVILEGE_GRANT_PERMISSION;
// } else if (hasChild(privilege,
NamespaceCache.SLIDE_NAMESPACE, "revoke-permission")) {
// return PRIVILEGE_REVOKE_PERMISSION;
+
+ } else {
+ if (allow_user_privileges){
+ return PRIVILEGE_USER_DEFINED;
} else {
+ List privileges = privilege.getChildren();
+ ListIterator iter = privileges.listIterator();
+ Element userPriv = (Element) iter.next();
System.err.println("Error: Unknown privilege !!!");
- throw new JDOMException("Unknown privilege
<"+privilege.getName()+">");
+ throw new JDOMException("Unknown privilege
<"+userPriv.getName()+">");
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]