You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2018/08/23 21:12:28 UTC

directory-fortress-core git commit: FC-239 - map key name to paSet in RoleConstraintAnt

Repository: directory-fortress-core
Updated Branches:
  refs/heads/master ab42f7dd1 -> c7d9a9008


FC-239 - map key name to paSet in RoleConstraintAnt


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/c7d9a900
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/c7d9a900
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/c7d9a900

Branch: refs/heads/master
Commit: c7d9a90089c0556b93bcbd4bc081ef9372a7c212
Parents: ab42f7d
Author: Shawn McKinney <sm...@apache.org>
Authored: Thu Aug 23 16:12:21 2018 -0500
Committer: Shawn McKinney <sm...@apache.org>
Committed: Thu Aug 23 16:12:21 2018 -0500

----------------------------------------------------------------------
 ldap/setup/RbacAbacSample.xml                   | 36 ++++++++++----------
 .../fortress/core/ant/FortressAntTask.java      |  2 ++
 .../fortress/core/ant/RoleConstraintAnt.java    | 22 ++++++++++++
 3 files changed, 42 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c7d9a900/ldap/setup/RbacAbacSample.xml
----------------------------------------------------------------------
diff --git a/ldap/setup/RbacAbacSample.xml b/ldap/setup/RbacAbacSample.xml
index caaf79b..287b196 100644
--- a/ldap/setup/RbacAbacSample.xml
+++ b/ldap/setup/RbacAbacSample.xml
@@ -77,32 +77,32 @@
             </addrole>
 
             <addroleconstraint>
-                <roleconstraint userId="curly" role="Tellers" paSetName="locale" value="east" typeName="USER"/>
-                <roleconstraint userId="curly" role="Washers" paSetName="locale" value="north" typeName="USER"/>
-                <roleconstraint userId="curly" role="Washers" paSetName="locale" value="south" typeName="USER"/>
+                <roleconstraint userId="curly" role="Tellers" key="locale" value="east" typeName="USER"/>
+                <roleconstraint userId="curly" role="Washers" key="locale" value="north" typeName="USER"/>
+                <roleconstraint userId="curly" role="Washers" key="locale" value="south" typeName="USER"/>
 
-                <roleconstraint userId="moe" role="Tellers" paSetName="locale" value="north" typeName="USER"/>
-                <roleconstraint userId="moe" role="Washers" paSetName="locale" value="east" typeName="USER"/>
-                <roleconstraint userId="moe" role="Washers" paSetName="locale" value="south" typeName="USER"/>
+                <roleconstraint userId="moe" role="Tellers" key="locale" value="north" typeName="USER"/>
+                <roleconstraint userId="moe" role="Washers" key="locale" value="east" typeName="USER"/>
+                <roleconstraint userId="moe" role="Washers" key="locale" value="south" typeName="USER"/>
 
-                <roleconstraint userId="larry" role="Tellers" paSetName="locale" value="south" typeName="USER"/>
-                <roleconstraint userId="larry" role="Washers" paSetName="locale" value="north" typeName="USER"/>
-                <roleconstraint userId="larry" role="Washers" paSetName="locale" value="east" typeName="USER"/>
+                <roleconstraint userId="larry" role="Tellers" key="locale" value="south" typeName="USER"/>
+                <roleconstraint userId="larry" role="Washers" key="locale" value="north" typeName="USER"/>
+                <roleconstraint userId="larry" role="Washers" key="locale" value="east" typeName="USER"/>
             </addroleconstraint>
 
 <!--
             <delroleconstraint>
-                <roleconstraint userId="curly" role="Tellers" paSetName="locale" value="east" typeName="USER"/>
-                <roleconstraint userId="curly" role="Washers" paSetName="locale" value="north" typeName="USER"/>
-                <roleconstraint userId="curly" role="Washers" paSetName="locale" value="south" typeName="USER"/>
+                <roleconstraint userId="curly" role="Tellers" key="locale" value="east" typeName="USER"/>
+                <roleconstraint userId="curly" role="Washers" key="locale" value="north" typeName="USER"/>
+                <roleconstraint userId="curly" role="Washers" key="locale" value="south" typeName="USER"/>
 
-                <roleconstraint userId="moe" role="Tellers" paSetName="locale" value="north" typeName="USER"/>
-                <roleconstraint userId="moe" role="Washers" paSetName="locale" value="east" typeName="USER"/>
-                <roleconstraint userId="moe" role="Washers" paSetName="locale" value="south" typeName="USER"/>
+                <roleconstraint userId="moe" role="Tellers" key="locale" value="north" typeName="USER"/>
+                <roleconstraint userId="moe" role="Washers" key="locale" value="east" typeName="USER"/>
+                <roleconstraint userId="moe" role="Washers" key="locale" value="south" typeName="USER"/>
 
-                <roleconstraint userId="larry" role="Tellers" paSetName="locale" value="south" typeName="USER"/>
-                <roleconstraint userId="larry" role="Washers" paSetName="locale" value="north" typeName="USER"/>
-                <roleconstraint userId="larry" role="Washers" paSetName="locale" value="east" typeName="USER"/>
+                <roleconstraint userId="larry" role="Tellers" key="locale" value="south" typeName="USER"/>
+                <roleconstraint userId="larry" role="Washers" key="locale" value="north" typeName="USER"/>
+                <roleconstraint userId="larry" role="Washers" key="locale" value="east" typeName="USER"/>
             </delroleconstraint>
 -->
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c7d9a900/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java b/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
index 23c810e..a7f1d9b 100755
--- a/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
+++ b/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
@@ -1426,6 +1426,7 @@ public class FortressAntTask extends Task implements InputHandler
             {
                 try
                 {
+                    roleConstraint.setPaSetName( roleConstraint.getKey() );
                     adminMgr.addRoleConstraint( new UserRole( roleConstraint.getUserId(), roleConstraint.getRole() ), roleConstraint );
                     LOG.info( "addRoleConstraint successfully added: tenant={} type={} userid={} role={} key={} value={}", getTenant(), roleConstraint.getType(), roleConstraint.getUserId(), roleConstraint.getRole(), roleConstraint.getPaSetName(), roleConstraint.getValue() );
                 }
@@ -1457,6 +1458,7 @@ public class FortressAntTask extends Task implements InputHandler
             {
                 try
                 {
+                    roleConstraint.setPaSetName( roleConstraint.getKey() );
                     adminMgr.removeRoleConstraint( new UserRole( roleConstraint.getUserId(), roleConstraint.getRole()
                     ), roleConstraint );
                     LOG.info( "removeRoleConstraint success: tenant={} type={} userid={} role={} key={} value={}",

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/c7d9a900/src/main/java/org/apache/directory/fortress/core/ant/RoleConstraintAnt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ant/RoleConstraintAnt.java b/src/main/java/org/apache/directory/fortress/core/ant/RoleConstraintAnt.java
index ab757b2..af9eac3 100644
--- a/src/main/java/org/apache/directory/fortress/core/ant/RoleConstraintAnt.java
+++ b/src/main/java/org/apache/directory/fortress/core/ant/RoleConstraintAnt.java
@@ -35,6 +35,28 @@ public class RoleConstraintAnt extends RoleConstraint
     /** Default serialVersionUID */
     private static final long serialVersionUID = 1L;
     private String role;
+    private String key;
+
+    /**
+     * Maps to paSetName in RoleConstraint entity.
+     *
+     * @return
+     */
+    public String getKey()
+    {
+        return key;
+    }
+
+    /**
+     * Maps to paSetName in RoleConstraint entity.
+     *
+     * @param key
+     */
+    public void setKey(String key)
+    {
+        this.key = key;
+    }
+
 
     /**
      *