directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject [2/3] directory-fortress-core git commit: FC-188 - add the paset and role constraint services
Date Fri, 07 Oct 2016 06:25:13 GMT
 FC-188 - add the paset and role constraint services


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/f443a65d
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/f443a65d
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/f443a65d

Branch: refs/heads/master
Commit: f443a65d8bca3365020c9f2a95a7ce2de6ea9e84
Parents: bb3eddf
Author: Shawn McKinney <smckinney@apache.org>
Authored: Fri Oct 7 01:24:29 2016 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Fri Oct 7 01:24:29 2016 -0500

----------------------------------------------------------------------
 .../fortress/core/rest/ReviewMgrRestImpl.java   | 70 +++++++++++++++++---
 1 file changed, 60 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/f443a65d/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
b/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
index bec46db..87105a6 100755
--- a/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/ReviewMgrRestImpl.java
@@ -1255,20 +1255,70 @@ public class ReviewMgrRestImpl extends Manageable implements ReviewMgr
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
 	@Override
-	public PermissionAttributeSet readPermAttributeSet(
-			PermissionAttributeSet permAttributeSet) throws SecurityException {
-		// TODO Auto-generated method stub
-		return null;
+	public PermissionAttributeSet readPermAttributeSet(	PermissionAttributeSet permAttributeSet
)
+        throws SecurityException
+    {
+        {
+            VUtil.assertNotNull(permAttributeSet, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM
+ ".readPermAttributeSet");
+            PermissionAttributeSet retPermSet;
+            FortRequest request = new FortRequest();
+            request.setContextId(this.contextId);
+            request.setEntity(permAttributeSet);
+            if (this.adminSess != null)
+            {
+                request.setSession(adminSess);
+            }
+            String szRequest = RestUtils.marshal(request);
+            String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_READ_PERM_ATTRIBUTE_SET);
+            FortResponse response = RestUtils.unmarshall(szResponse);
+            if (response.getErrorCode() == 0)
+            {
+                retPermSet = (PermissionAttributeSet)response.getEntity();
+            }
+            else
+            {
+                throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
+            }
+            return retPermSet;
+        }
 	}
 
 
+    /**
+     * {@inheritDoc}
+     */
 	@Override
-	public List<RoleConstraint> findRoleConstraints(User user, Permission permission,
RoleConstraint.RCType rcType)
-			throws SecurityException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
+	public List<RoleConstraint> findRoleConstraints( User user, Permission permission,
RoleConstraint.RCType rcType )
+			throws SecurityException
+    {
+        VUtil.assertNotNull(user, GlobalErrIds.USER_NULL, CLS_NM + ".findRoleConstraints");
+        VUtil.assertNotNull(user, GlobalErrIds.PERM_NULL, CLS_NM + ".findRoleConstraints");
 
+        List<RoleConstraint> retConstraints;
+        FortRequest request = new FortRequest();
+        request.setContextId(this.contextId);
+        request.setEntity( user );
+        request.setEntity2( permission);
+        request.setValue( rcType.toString() );
+        if (this.adminSess != null)
+        {
+            request.setSession(adminSess);
+        }
+        String szRequest = RestUtils.marshal(request);
+        String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_FIND_CONSTRAINTS);
+        FortResponse response = RestUtils.unmarshall(szResponse);
+        if (response.getErrorCode() == 0)
+        {
+            retConstraints = response.getEntities();
+        }
+        else
+        {
+            throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
+        }
+        return retConstraints;
+	}
 }
\ No newline at end of file


Mime
View raw message