You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/06/08 00:05:47 UTC

[70/90] [abbrv] incubator-geode git commit: GEODE-1450: Move ExampleJSONAuthorization out of 'test' and into 'main'

GEODE-1450: Move ExampleJSONAuthorization out of 'test' and into 'main'


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/1aa39174
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/1aa39174
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/1aa39174

Branch: refs/heads/feature/GEODE-835
Commit: 1aa39174daa8ab2b2017013a62ff297fda7362e4
Parents: d24a5fb
Author: Jens Deppe <jd...@pivotal.io>
Authored: Thu Jun 2 10:46:59 2016 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Thu Jun 2 10:46:59 2016 -0700

----------------------------------------------------------------------
 .../gemfire/security/templates/SampleJsonAuthorization.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1aa39174/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
index 5723ea5..dca64e7 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/security/templates/SampleJsonAuthorization.java
@@ -178,11 +178,10 @@ public class SampleJsonAuthorization implements AccessControl, Authenticator {
 
       for (JsonNode op : r.get("operationsAllowed")) {
         String[] parts = op.asText().split(":");
-        if (regionNames == null) {
-          role.permissions.add(new ResourceOperationContext(parts[0], parts[1], "*", false));
-        } else {
-          role.permissions.add(new ResourceOperationContext(parts[0], parts[1], regionNames, false));
-        }
+        String resourcePart = (parts.length > 0) ? parts[0] : null;
+        String operationPart = (parts.length > 1) ? parts[1] : null;
+        String regionPart = (regionNames != null) ? regionNames : "*";
+        role.permissions.add(new ResourceOperationContext(resourcePart, operationPart, regionPart, false));
       }
 
       roleMap.put(role.name, role);