You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@apache.org on 2001/07/11 07:21:05 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/structure StructureImpl.java
remm 01/07/10 22:21:05
Modified: src/share/org/apache/slide/structure StructureImpl.java
Log:
- The role checking algorithm was incorrect.
Patch submitted by Christopher Lenz <cmlenz at gmx.de>
Revision Changes Path
1.20 +18 -12 jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java
Index: StructureImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- StructureImpl.java 2001/05/29 02:42:43 1.19
+++ StructureImpl.java 2001/07/11 05:21:04 1.20
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v 1.19 2001/05/29 02:42:43 remm Exp $
- * $Revision: 1.19 $
- * $Date: 2001/05/29 02:42:43 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/structure/StructureImpl.java,v 1.20 2001/07/11 05:21:04 remm Exp $
+ * $Revision: 1.20 $
+ * $Date: 2001/07/11 05:21:04 $
*
* ====================================================================
*
@@ -78,7 +78,7 @@
* Data helper class.
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.19 $
+ * @version $Revision: 1.20 $
*/
public final class StructureImpl implements Structure {
@@ -354,14 +354,20 @@
ObjectNotFoundException, LinkedObjectNotFoundException,
AccessDeniedException {
- // Checking role
- if (!securityHelper.hasRole(token, object.getClass().getName())) {
- // Allow the namespace admin to create roles he doesn't have
- Uri rootUri = namespace.getUri(token, "/");
- ObjectNode rootObject = rootUri.getStore().retrieveObject(rootUri);
- securityHelper.checkCredentials
- (token, rootObject,
- namespaceConfig.getGrantPermissionAction());
+ // Checking roles
+ Enumeration roles = securityHelper.getRoles(object);
+ while (roles.hasMoreElements()) {
+ if (!securityHelper.hasRole(token, (String)roles.nextElement())) {
+ // Allow only the namespace admin to create roles
+ // he doesn't have
+ Uri rootUri = namespace.getUri(token, "/");
+ ObjectNode rootObject =
+ rootUri.getStore().retrieveObject(rootUri);
+ securityHelper.checkCredentials
+ (token, rootObject,
+ namespaceConfig.getGrantPermissionAction());
+ break;
+ }
}
String resolvedUri = strUri;