Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Improved permissions tree building and parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-crum committed Jan 11, 2010
1 parent 21756ca commit 6ca89da
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 26 deletions.
48 changes: 32 additions & 16 deletions BranchReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
ExecutionContext and Security-Aware Artifacts Notes
---------------------------------------------------

2010-01-11: The ExecutionContext implementation is fairly complete.

The security-aware artifacts implementation is mostly complete
(the AuthorizationManager CRUD methods are not written and the
EntityListIterator is not security-aware), but its use
in the branch is still proof-of-concept. In other words, the
design is implemented and working, but very little of the project uses it.

Some examples: The screen renderer doesn't catch the security exceptions,
so when a user is denied access to an artifact they get the JSP error page.
Also, the main navigation doesn't display the Example component tab because
the Freemarker template is still checking the old-style permissions.

---------------------------------------------------

2010-01-05: Artifact paths now support substitution ("?")
and wildcard ("*") path elements.
This solves an issue that was discussed during the design - how
to grant access to a particular artifact regardless of the
execution path. You can see examples of their use in
framework/security/data/SecurityData.xml and
framework/example/data/ExampleSecurityData.xml.

The Example component has been converted to the new
security design.

The Execution Context seems to fulfill all needs so far, and it
works pretty well, so its API could be considered stable at
this time.

---------------------------------------------------

2009-12-31: I put this text file in the branch as a means
of keeping anyone who is interested updated on the progress
of the branch.
Expand Down Expand Up @@ -64,19 +96,3 @@ The Authorization Manager is mostly working. Filtering
EntityListIterator values is not implemented due to architectural
problems.

---------------------------------------------------

2010-01-05: Artifact paths now support substitution ("?")
and wildcard ("*") path elements.
This solves an issue that was discussed during the design - how
to grant access to a particular artifact regardless of the
execution path. You can see examples of their use in
framework/security/data/SecurityData.xml and
framework/example/data/ExampleSecurityData.xml.

The Example component has been converted to the new
security design.

The Execution Context seems to fulfill all needs so far, and it
works pretty well, so its API could be considered stable at
this time.
3 changes: 1 addition & 2 deletions framework/context/src/org/ofbiz/context/TreeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ public void visit(SubstitutionNode node) {
@Override
public void visit(WildCardNode node) {
if (this.artifactPath.hasNext()) {
this.artifactPath.next();
this.addChildNode(node, this.artifactPath.getCurrentPath());
this.addChildNode(node, this.artifactPath.next());
}
}
}
14 changes: 6 additions & 8 deletions framework/context/src/org/ofbiz/context/TreeWalker.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*******************************************************************************/
package org.ofbiz.context;

import java.util.Map;

import org.ofbiz.context.PathNode.BranchNode;
import org.ofbiz.context.PathNode.SubstitutionNode;
import org.ofbiz.context.PathNode.WildCardNode;
Expand Down Expand Up @@ -59,12 +57,12 @@ public void visit(SubstitutionNode node) {

@Override
public void visit(WildCardNode node) {
if (this.artifactPath.hasNext() && node.childNodes != null) {
this.artifactPath.next();
String currentPath = this.artifactPath.getCurrentPath().toUpperCase();
for (Map.Entry<String, PathNode> entry : node.childNodes.entrySet()) {
if (currentPath.endsWith(entry.getKey())) {
entry.getValue().accept(this);
if (node.childNodes != null) {
while (this.artifactPath.hasNext()) {
String key = this.artifactPath.next().toUpperCase();
PathNode childNode = node.childNodes.get(key);
if (childNode != null) {
childNode.accept(this);
return;
}
}
Expand Down

0 comments on commit 6ca89da

Please sign in to comment.