Author: prabath
Date: Tue Feb 19 03:51:44 2008
New Revision: 13892

Log:

ui changes to add multiple profile for a given user - further testing required

Modified:
   trunk/solutions/identity/modules/identity-provider/conf/default-store.sql
   
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
   
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityUserStoreReader.java
   
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/UIConstants.java
   
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/AddUserProfileAction.java
   
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
   
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/interceptor/SessionInterceptor.java
   trunk/solutions/identity/modules/user-ui/src/main/resources/struts.xml
   trunk/solutions/identity/modules/user-ui/src/main/webapp/jsp/main.jsp

Modified: 
trunk/solutions/identity/modules/identity-provider/conf/default-store.sql
==============================================================================
--- trunk/solutions/identity/modules/identity-provider/conf/default-store.sql   
(original)
+++ trunk/solutions/identity/modules/identity-provider/conf/default-store.sql   
Tue Feb 19 03:51:44 2008
@@ -6,6 +6,6 @@
 CREATE TABLE UM_ROLE_PERMISSIONS (ID VARCHAR(255), PERMISSION_ID VARCHAR(255), 
ROLE_ID VARCHAR(255), IS_ALLOWED SMALLINT NOT NULL, FOREIGN KEY (PERMISSION_ID) 
REFERENCES UM_PERMISSIONS(ID) ON DELETE  CASCADE, FOREIGN KEY (ROLE_ID) 
REFERENCES UM_ROLES(ID) ON DELETE CASCADE, PRIMARY KEY (ID));
 CREATE TABLE UM_USER_PERMISSIONS (ID VARCHAR(255), IS_ALLOWED SMALLINT NOT 
NULL, PERMISSION_ID VARCHAR(255), USER_ID VARCHAR(255), FOREIGN KEY 
(PERMISSION_ID) REFERENCES UM_PERMISSIONS(ID) ON DELETE CASCADE, FOREIGN KEY 
(USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE, PRIMARY KEY (ID));
 CREATE TABLE UM_USER_ROLES (ID VARCHAR(255), ROLE_ID VARCHAR(255), USER_ID 
VARCHAR(255), FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE, 
FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE, PRIMARY KEY 
(ID));
-CREATE TABLE USER_PROFILE (ID VARCHAR(255), USER_ID VARCHAR(255) NOT NULL 
UNIQUE, PROFILE_ID VARCHAR(255) NOT NULL UNIQUE,PROFILE_NAME VARCHAR(255) NOT 
NULL,IS_DEFAULT SMALLINT NOT NULL, PRIMARY KEY (ID));
+CREATE TABLE USER_PROFILE (ID VARCHAR(255), USER_ID VARCHAR(255) NOT NULL, 
PROFILE_ID VARCHAR(255) NOT NULL UNIQUE,PROFILE_NAME VARCHAR(255) NOT 
NULL,IS_DEFAULT SMALLINT NOT NULL, PRIMARY KEY (ID));
 CREATE TABLE USER_PROFILE_VALUES (ID VARCHAR(255), ATTR_NAME VARCHAR(255) NOT 
NULL, ATTR_VALUE VARCHAR(255), PROFILE_ID VARCHAR(255), PRIMARY KEY (ID));
 

Modified: 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
==============================================================================
--- 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
      (original)
+++ 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
      Tue Feb 19 03:51:44 2008
@@ -295,9 +295,16 @@
         return props;
     }
 
-    public boolean isExistingUserProfile(String userName, String profilrName)
+    public boolean isExistingUserProfile(String userName, String profileName)
             throws UserManagerException {
-        // TODO Auto-generated method stub
+
+        Map properties = null;
+
+        properties = getUserProperties(userName, profileName);
+
+        if (properties != null && properties.size() > 0)
+            return true;
+
         return false;
     }
 }

Modified: 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityUserStoreReader.java
==============================================================================
--- 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityUserStoreReader.java
     (original)
+++ 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityUserStoreReader.java
     Tue Feb 19 03:51:44 2008
@@ -16,6 +16,6 @@
     public String getDefaultUserProfileName(String userName)
             throws UserManagerException;
 
-    public boolean isExistingUserProfile(String userName, String profilrName)
+    public boolean isExistingUserProfile(String userName, String profileName)
             throws UserManagerException;
 }

Modified: 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/UIConstants.java
==============================================================================
--- 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/UIConstants.java
 (original)
+++ 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/UIConstants.java
 Tue Feb 19 03:51:44 2008
@@ -78,7 +78,10 @@
     public final static String CLAIM_UPDATE_DISABLE = "disable";
     
     public final static String UPDATE_OPENID_USER_RP_ACTION = 
"UpdateOpenIDUserRP.action";
-   
+    
+    public final static String ADD_USER_PROFILE_ACTION = 
"AddUserProfile.action";
+    
+    public final static String ADD_USER_PROFILE_SUBMIT_ACTION = 
"AddUserProfileSubmit.action";   
     
     
  

Modified: 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/AddUserProfileAction.java
==============================================================================
--- 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/AddUserProfileAction.java
 (original)
+++ 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/AddUserProfileAction.java
 Tue Feb 19 03:51:44 2008
@@ -1,5 +1,6 @@
 package org.wso2.solutions.identity.user.ui.action;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -21,7 +22,12 @@
 
         ClaimsAdmin ClaimsAdmin = new ClaimsAdmin();
         ClaimDO[] claimDOs = ClaimsAdmin.getAllMappedEnabledClaims();
-        this.claims = Arrays.asList((ClaimDO[]) claimDOs);
+        claims = new ArrayList<ClaimDO>();
+        for (int i = 0; i < claimDOs.length; i++) {
+            if(claimDOs[i].isUserEditable()) {
+                claims.add(claimDOs[i]);
+            }
+        }
 
         return SUCCESS;
     }

Modified: 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
==============================================================================
--- 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
       (original)
+++ 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
       Tue Feb 19 03:51:44 2008
@@ -50,6 +50,16 @@
 
     private boolean enableOpenIDRegistration;
 
+    private boolean allowUserRegistration;
+
+    public boolean isAllowUserRegistration() {
+        return allowUserRegistration;
+    }
+
+    public void setAllowUserRegistration(boolean allowUserRegistration) {
+        this.allowUserRegistration = allowUserRegistration;
+    }
+
     public String execute() throws Exception {
 
         RelyingPartyAdmin admin = new RelyingPartyAdmin();
@@ -61,6 +71,9 @@
         this.enableOpenIDRegistration = paramAdmin
                 
.getParameter(IdentityProviderConstants.PARAM_NAME_ENABLE_OPENID_REGISTRATION) 
!= null;
 
+        this.allowUserRegistration = paramAdmin
+                
.getParameter(IdentityProviderConstants.PARAM_NAME_ALLOW_USER_REGISTRATION) != 
null;
+
         this.personalRPs = Arrays.asList((UserTrustedRPDO[]) admin
                 .getAllPersonalRelyingParties(user));
 

Modified: 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/interceptor/SessionInterceptor.java
==============================================================================
--- 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/interceptor/SessionInterceptor.java
      (original)
+++ 
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/interceptor/SessionInterceptor.java
      Tue Feb 19 03:51:44 2008
@@ -61,12 +61,18 @@
                 && requestURL.toString().indexOf(
                         UIConstants.OPENID_INFO_CARD__DOWNLOAD_ACTION) < 0
                 && requestURL.toString().indexOf(
+                        UIConstants.ADD_USER_PROFILE_ACTION) < 0
+                && requestURL.toString().indexOf(
+                        UIConstants.ADD_USER_PROFILE_SUBMIT_ACTION) < 0
+                && requestURL.toString().indexOf(
                         UIConstants.OPENDID_CALLBACK_ACTION) < 0
-                && 
requestURL.indexOf(UIConstants.OPENID_SELFISSUED_LOGIN_ACTION) < 0
+                && requestURL
+                        .indexOf(UIConstants.OPENID_SELFISSUED_LOGIN_ACTION) < 0
                 && requestURL.indexOf(UIConstants.OPENID_AUTH_ACTION) < 0
-                && 
requestURL.indexOf(UIConstants.OPENID_AUTH_VERIFICATION_ACTION) < 0
+                && requestURL
+                        .indexOf(UIConstants.OPENID_AUTH_VERIFICATION_ACTION) 
< 0
                 && requestURL.indexOf(UIConstants.OPENID_USER_APPROVAL_ACTION) 
< 0
-                && 
requestURL.indexOf(UIConstants.UPDATE_OPENID_USER_RP_ACTION) < 0                
+                && 
requestURL.indexOf(UIConstants.UPDATE_OPENID_USER_RP_ACTION) < 0
                 && requestURL.toString().indexOf(
                         UIConstants.OPENID_LOGIN_ACTION) < 0) {
             // If the request is not Login.action

Modified: trunk/solutions/identity/modules/user-ui/src/main/resources/struts.xml
==============================================================================
--- trunk/solutions/identity/modules/user-ui/src/main/resources/struts.xml      
(original)
+++ trunk/solutions/identity/modules/user-ui/src/main/resources/struts.xml      
Tue Feb 19 03:51:44 2008
@@ -196,5 +196,19 @@
              <result name="success" type="redirect">ShowMain.action</result> 
             <result name="error" type="redirect">Login.action</result>       
         </action>  
+        
+        <action name="AddUserProfile"
+                
class="org.wso2.solutions.identity.user.ui.action.AddUserProfileAction">
+             <result name="success">/jsp/adduserprofile.jsp</result> 
+            <result name="error" type="redirect">Login.action</result>       
+        </action>
+        
+         <action name="AddUserProfileSubmit"
+                
class="org.wso2.solutions.identity.user.ui.action.AddUserProfileSubmitAction">
+            <result name="success" type="redirect">ShowMain.action</result>
+            <result name="input" type="redirect">AddUserProfile.action</result>
+            <result name="error" type="redirect">AddUserProfile.action</result>
+        </action>
+        
     </package>
 </struts>
\ No newline at end of file

Modified: trunk/solutions/identity/modules/user-ui/src/main/webapp/jsp/main.jsp
==============================================================================
--- trunk/solutions/identity/modules/user-ui/src/main/webapp/jsp/main.jsp       
(original)
+++ trunk/solutions/identity/modules/user-ui/src/main/webapp/jsp/main.jsp       
Tue Feb 19 03:51:44 2008
@@ -45,6 +45,9 @@
                </s:iterator> <br>
                <!-- New STARTS Here -->
                <div class="information">
+               <s:if test="%{allowUserRegistration}">
+                       <div><br/><a href="AddUserProfile.action">Add new 
profile</a><br/></div>
+               </s:if>
                <table cellpadding="0" cellspacing="0" border="0"
                        style="width: 100%; margin-bottom: 10px;">
                        <tr>

_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev

Reply via email to