directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-commander git commit: FC-181 - Multitenancy for Web
Date Tue, 20 Sep 2016 17:37:13 GMT
Repository: directory-fortress-commander
Updated Branches:
  refs/heads/master 9a708ce9d -> e6b13ba08


 FC-181 - Multitenancy for Web


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

Branch: refs/heads/master
Commit: e6b13ba082121932e6692be7d14cf9c5cee8a766
Parents: 9a708ce
Author: Shawn McKinney <smckinney@apache.org>
Authored: Tue Sep 20 12:33:11 2016 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Tue Sep 20 12:33:11 2016 -0500

----------------------------------------------------------------------
 .../fortress/web/FortressWebBasePage.java       |  1 -
 .../fortress/web/model/UserListModel.java       |  6 ++-
 .../fortress/web/panel/UserListPanel.java       |  2 +-
 src/main/resources/META-INF/context.xml         |  4 +-
 src/main/resources/applicationContext.xml       | 44 ++++++++------------
 src/main/resources/fortress.properties.example  |  2 +
 6 files changed, 27 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/e6b13ba0/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
index 9da9a5e..c4d26eb 100644
--- a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
+++ b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
@@ -23,7 +23,6 @@ package org.apache.directory.fortress.web;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.realm.J2eePolicyMgr;
-import org.apache.directory.fortress.web.common.*;
 import org.apache.directory.fortress.web.control.SecUtils;
 import org.apache.directory.fortress.web.control.SecureBookmarkablePageLink;
 import org.apache.directory.fortress.web.control.WicketSession;

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/e6b13ba0/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java b/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java
index 1eb388b..edc32aa 100644
--- a/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java
+++ b/src/main/java/org/apache/directory/fortress/web/model/UserListModel.java
@@ -114,14 +114,16 @@ public class UserListModel extends Model<SerializableList<User>>
         if ( ( user == null ) && ( perm == null  ))
         {
             log.debug( ".getObject null" );
-            users = new SerializableList<>( new ArrayList<User>() );
         }
         else
         {
             //log.debug(".getObject userId: " + user != null ? user.getUserId() : "null");
             users = new SerializableList<>( getList( user ) );
         }
-        
+        // guard against NPE:
+        if ( users == null )
+            users = new SerializableList<>( new ArrayList<User>() );
+
         return users;
     }
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/e6b13ba0/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
index cf6fcdb..223907f 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/UserListPanel.java
@@ -676,7 +676,7 @@ public class UserListPanel<T extends Serializable> extends FormComponentPanel
             LOG.debug( ".createTreeModel Users found:" + users.size() );
             for ( T user : users )
             {
-                    rootNode.add( new DefaultMutableTreeNode( user ) );
+                rootNode.add( new DefaultMutableTreeNode( user ) );
             }
         }
         return model;

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/e6b13ba0/src/main/resources/META-INF/context.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/context.xml b/src/main/resources/META-INF/context.xml
index 2918eee..1b98e74 100644
--- a/src/main/resources/META-INF/context.xml
+++ b/src/main/resources/META-INF/context.xml
@@ -22,6 +22,6 @@
            defaultRoles=""
            containerType="TomcatContext"
            realmClasspath=""
-            />
-
+           contextId="HOME"
+           />
 </Context>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/e6b13ba0/src/main/resources/applicationContext.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/applicationContext.xml b/src/main/resources/applicationContext.xml
index 1376a6a..a36449b 100644
--- a/src/main/resources/applicationContext.xml
+++ b/src/main/resources/applicationContext.xml
@@ -21,6 +21,7 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:sec="http://www.springframework.org/schema/security"
        xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/beans
@@ -28,63 +29,54 @@
         http://www.springframework.org/schema/util
         http://www.springframework.org/schema/util/spring-util.xsd
         http://www.springframework.org/schema/security
-        http://www.springframework.org/schema/security/spring-security.xsd">
+        http://www.springframework.org/schema/security/spring-security.xsd
+        http://www.springframework.org/schema/context
+	    http://www.springframework.org/schema/context/spring-context.xsd
+        ">
 
     <!-- Housekeeping -->
-    <bean id="baseURL" class="java.lang.String">
-        <constructor-arg value="${scheme}://${host}:${port}${rootPath}"/>
-    </bean>
-    <bean id="site" class="java.lang.String">
-        <constructor-arg value="${project.parent.url}"/>
-    </bean>
-    <bean id="license" class="java.lang.String">
-        <constructor-arg value="${licenseUrl}"/>
-    </bean>
-    <bean id="HOME" class="java.lang.String">
-        <constructor-arg value="HOME"/>
-    </bean>
+    <context:property-placeholder location="classpath:fortress.properties" />
 
-    <!-- These Fortress Manager beans are used as api for RBAC/IAM domain model -->
+    <!-- These Fortress Manager beans are used as api for RBAC domain model -->
     <bean id="reviewMgr" class="org.apache.directory.fortress.core.ReviewMgrFactory" scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
     <bean id="adminMgr" class="org.apache.directory.fortress.core.AdminMgrFactory" scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
     <bean id="accessMgr" class="org.apache.directory.fortress.core.AccessMgrFactory" scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="#{systemProperties['contextId'] ?: 'HOME'}"/>
     </bean>
     <bean id="delReviewMgr" class="org.apache.directory.fortress.core.DelReviewMgrFactory"
scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
     <bean id="delAdminMgr" class="org.apache.directory.fortress.core.DelAdminMgrFactory"
scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
     <bean id="delAccessMgr" class="org.apache.directory.fortress.core.DelAccessMgrFactory"
scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
     <bean id="auditMgr" class="org.apache.directory.fortress.core.AuditMgrFactory" scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
     <bean id="pwPolicyMgr" class="org.apache.directory.fortress.core.PwPolicyMgrFactory"
scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
     <bean id="groupMgr" class="org.apache.directory.fortress.core.GroupMgrFactory" scope="prototype"
           factory-method="createInstance">
-        <constructor-arg value="HOME"/>
+        <constructor-arg value="${contextId:HOME}"/>
     </bean>
-    <!-- The Fortress Realm J2EE Manager bean used for deserializing the principal as
returned from tomcat -->
+    <!-- TODO: after the realm 1.0.2 release pass the contextId here.  -->
     <bean id="j2eePolicyMgr" class="org.apache.directory.fortress.realm.J2eePolicyMgrFactory"
scope="prototype"
-          factory-method="createInstance">
-    </bean>
+          factory-method="createInstance"/>
 
     <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
         <property name="targetObject">

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/e6b13ba0/src/main/resources/fortress.properties.example
----------------------------------------------------------------------
diff --git a/src/main/resources/fortress.properties.example b/src/main/resources/fortress.properties.example
index ec33f68..88338be 100644
--- a/src/main/resources/fortress.properties.example
+++ b/src/main/resources/fortress.properties.example
@@ -17,6 +17,8 @@
 #   under the License.
 #
 
+contextId=HOME
+
 # Used by application security components:
 perms.cached=true
 


Mime
View raw message