directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-enmasse git commit: FC-188 - add rolePermissionAttributeSets service
Date Mon, 10 Oct 2016 18:07:26 GMT
Repository: directory-fortress-enmasse
Updated Branches:
  refs/heads/master 39a4a2e41 -> 8908aa9cc


FC-188 - add rolePermissionAttributeSets service


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

Branch: refs/heads/master
Commit: 8908aa9cc54f59bb591fbf9c55b7ffd86a86ae64
Parents: 39a4a2e
Author: Shawn McKinney <smckinney@apache.org>
Authored: Mon Oct 10 12:46:01 2016 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Mon Oct 10 12:46:01 2016 -0500

----------------------------------------------------------------------
 .../fortress/rest/FortressService.java          | 18 ++++++++++++++
 .../fortress/rest/FortressServiceImpl.java      | 15 +++++++++--
 .../directory/fortress/rest/ReviewMgrImpl.java  | 26 ++++++++++++++++++--
 3 files changed, 55 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/blob/8908aa9c/src/main/java/org/apache/directory/fortress/rest/FortressService.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/rest/FortressService.java b/src/main/java/org/apache/directory/fortress/rest/FortressService.java
index 8e9927f..aa01f1d 100644
--- a/src/main/java/org/apache/directory/fortress/rest/FortressService.java
+++ b/src/main/java/org/apache/directory/fortress/rest/FortressService.java
@@ -7060,4 +7060,22 @@ public interface FortressService
      * @throws SecurityException In the event system error occurs.
      */
     FortResponse readPermAttributeSet( FortRequest request );
+
+
+    /**
+     * This function returns all the permission attribute set (which contain 0 to many permission
attributes)
+     * for a given role. The function is valid if and only if the role is a member of the
ROLES data
+     * set.
+     *      * <h3></h3>
+     * <h4>required parameters</h4>
+     * <ul>
+     *   <li>{@link org.apache.directory.fortress.core.model.Role#name} - contains
the name to use for the Role targeted for search.</li>
+     * </ul>
+     *
+     * @param role contains role name, {@link org.apache.directory.fortress.core.model.Role#name}
of Role entity Permission is granted to.
+     * @param noInheritance if true will NOT include inherited roles in the search.
+     * @return List of type PermissionAttributeSet that contains all Permission Attribute
valid for the role.
+     * @throws SecurityException In the event system error occurs.
+     */
+    public FortResponse rolePermissionAttributeSets( FortRequest request );
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/blob/8908aa9c/src/main/java/org/apache/directory/fortress/rest/FortressServiceImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/rest/FortressServiceImpl.java b/src/main/java/org/apache/directory/fortress/rest/FortressServiceImpl.java
index 1d43593..5a8b696 100644
--- a/src/main/java/org/apache/directory/fortress/rest/FortressServiceImpl.java
+++ b/src/main/java/org/apache/directory/fortress/rest/FortressServiceImpl.java
@@ -870,7 +870,7 @@ public class FortressServiceImpl implements FortressService
     @Override
     public FortResponse findRoleConstraints( FortRequest request )
     {
-        return reviewMgrImpl.findRoleConstraints( request );
+        return reviewMgrImpl.findRoleConstraintsM( request );
     }
 
     /**
@@ -944,9 +944,20 @@ public class FortressServiceImpl implements FortressService
     @Override
     public FortResponse readPermAttributeSet( FortRequest request )
     {
-        return reviewMgrImpl.readPermAttributeSet( request );
+        return reviewMgrImpl.readPermAttributeSetM( request );
     }
 
+
+    @POST
+    @Path("/" + HttpIds.ROLE_PERM_ATTR_SETS + "/")
+    @RolesAllowed({SUPER_USER, REVIEW_MGR_USER})
+    @Override
+    public FortResponse rolePermissionAttributeSets( FortRequest request )
+    {
+        return reviewMgrImpl.rolePermissionAttributeSetsM( request );
+    }
+
+
     /**
      * {@inheritDoc}
      */

http://git-wip-us.apache.org/repos/asf/directory-fortress-enmasse/blob/8908aa9c/src/main/java/org/apache/directory/fortress/rest/ReviewMgrImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/rest/ReviewMgrImpl.java b/src/main/java/org/apache/directory/fortress/rest/ReviewMgrImpl.java
index 4669f9c..d1e6051 100644
--- a/src/main/java/org/apache/directory/fortress/rest/ReviewMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/rest/ReviewMgrImpl.java
@@ -734,7 +734,7 @@ class ReviewMgrImpl extends AbstractMgrImpl
     }
 
 
-    /* No qualifier */  FortResponse findRoleConstraints( FortRequest request )
+    /* No qualifier */  FortResponse findRoleConstraintsM(FortRequest request)
     {
         FortResponse response = createResponse();
 
@@ -757,7 +757,29 @@ class ReviewMgrImpl extends AbstractMgrImpl
     }
 
 
-    /* No qualifier */  FortResponse readPermAttributeSet( FortRequest request )
+    /* No qualifier */  FortResponse rolePermissionAttributeSetsM(FortRequest request)
+    {
+        FortResponse response = createResponse();
+
+        try
+        {
+            ReviewMgr reviewMgr = ReviewMgrFactory.createInstance( request.getContextId()
);
+            reviewMgr.setAdmin( request.getSession() );
+            Role inRole = (Role) request.getEntity();
+            boolean isReplace = request.getIsFlag();
+            List<PermissionAttributeSet> retAttrSets = reviewMgr.rolePermissionAttributeSets(
inRole, isReplace );
+            response.setEntities( retAttrSets );
+        }
+        catch ( SecurityException se )
+        {
+            createError( response, LOG, se );
+        }
+
+        return response;
+    }
+
+
+    /* No qualifier */  FortResponse readPermAttributeSetM(FortRequest request)
     {
         FortResponse response = createResponse();
 


Mime
View raw message