[Carbon-dev] svn commit r43096 - in trunk/carbon: org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc org.wso2.carbon.user.mgt.ui/src/main/resources/web/role org.wso2.carbon.user.mgt.ui/src/main/resources/web/user org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt

dimuthul at wso2.com dimuthul at wso2.com
Tue Aug 11 04:06:43 PDT 2009


Author: dimuthul
Date: Tue Aug 11 04:06:43 2009
New Revision: 43096
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=43096

Log:
Committing the bug fixed done for read only user store.
two more tests to be done to release.



Modified:
   trunk/carbon/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java
   trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/edit-users.jsp
   trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/role-mgt.jsp
   trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/user-mgt.jsp
   trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/index.jsp
   trunk/carbon/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/UserAdmin.java

Modified: trunk/carbon/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java?rev=43096&r1=43095&r2=43096&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java	(original)
+++ trunk/carbon/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/jdbc/JDBCUserStoreManager.java	Tue Aug 11 04:06:43 2009
@@ -156,15 +156,15 @@
     }
 
     public String[] getUserListOfRole(String roleName) throws UserStoreException {
-        String sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_USERS_IN_ROLE_SQL);
-        if (sqlStmt == null) {
-            throw new UserStoreException("The sql statement for retrieving user roles is null");
-        }
-        String[] names = getStringValuesFromDatabase(sqlStmt, roleName);
-
-        if (isReadOnly() == true) {
-            String[] hybrids = hybridRoleManager.getUserListOfHybridRole(roleName);
-            names = UMUtil.combineArrays(names, hybrids);
+        String[] names = new String[0]; 
+        if (isReadOnly() == true && hybridRoleManager.isExistingRole(roleName)) {
+            names = hybridRoleManager.getUserListOfHybridRole(roleName);
+        }else{
+            String sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_USERS_IN_ROLE_SQL);
+            if (sqlStmt == null) {
+                throw new UserStoreException("The sql statement for retrieving user roles is null");
+            }
+            names = getStringValuesFromDatabase(sqlStmt, roleName);
         }
 
         return names;
@@ -473,7 +473,7 @@
     }
 
     public void deleteRole(String roleName) throws UserStoreException {
-        if (isReadOnly() == true) {
+        if (isReadOnly() == true && hybridRoleManager.isExistingRole(roleName)) {
             hybridRoleManager.deleteHybridRole(roleName);
         } else {
             if (realmConfig.getAdminRoleName().equals(roleName)) {
@@ -572,7 +572,7 @@
     public void updateUserListOfRole(String roleName, String deletedUsers[], String[] newUsers)
             throws UserStoreException {
 
-        if (isReadOnly() == true) {
+        if (isReadOnly() == true && hybridRoleManager.isExistingRole(roleName)) {
             hybridRoleManager.updateUserListOfHybridRole(roleName, deletedUsers, newUsers);
         } else {
             String sqlStmt1 = realmConfig

Modified: trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/edit-users.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/edit-users.jsp?rev=43096&r1=43095&r2=43096&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/edit-users.jsp	(original)
+++ trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/edit-users.jsp	Tue Aug 11 04:06:43 2009
@@ -171,7 +171,7 @@
                                                 }
                                 %>
                                 <input type="checkbox" name="selectedUsers"
-                                               value="<%=name%>" <%=docheck%>/><%=name.getItemName()%><input type="hidden" name="shownUsers" value="<%=name.getItemName()%>"/><br/>
+                                               value="<%=name.getItemName()%>" <%=docheck%>/><%=name.getItemName()%><input type="hidden" name="shownUsers" value="<%=name.getItemName()%>"/><br/>
                                     <%
                                             }
                                         }

Modified: trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/role-mgt.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/role-mgt.jsp?rev=43096&r1=43095&r2=43096&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/role-mgt.jsp	(original)
+++ trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/role/role-mgt.jsp	Tue Aug 11 04:06:43 2009
@@ -75,10 +75,11 @@
                     <td><%=data.getItemName()%>
                     </td>
                     <td>
-<a href="view-role.jsp?roleName=<%=data.getItemName()%>&userType=internal" class="icon-link" style="background-image:url(images/view.gif);"><fmt:message key="view"/></a>
-<a href="edit-users.jsp?roleName=<%=data.getItemName()%>&userType=internal" class="icon-link" style="background-image:url(images/edit.gif);"><fmt:message key="edit.users"/></a>
-<a href="edit-permissions.jsp?roleName=<%=data.getItemName()%>&userType=internal" class="icon-link" style="background-image:url(images/edit.gif);"><fmt:message key="edit.permissions"/></a>
+<a href="edit-permissions.jsp?roleName=<%=data.getItemName()%>" class="icon-link" style="background-image:url(images/edit.gif);"><fmt:message key="edit.permissions"/></a>
+                    <% if (data.isHybridItem() == true) {%>
+<a href="edit-users.jsp?roleName=<%=data.getItemName()%>" class="icon-link" style="background-image:url(images/edit.gif);"><fmt:message key="edit.users"/></a>
 <a href="#" onclick="deleteUserGroup('<%=data.getItemName()%>')" class="icon-link" style="background-image:url(images/delete.gif);"><fmt:message key="delete"/></a>
+                    <% } %>
                     </td>
                 </tr>
                 <%

Modified: trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/user-mgt.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/user-mgt.jsp?rev=43096&r1=43095&r2=43096&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/user-mgt.jsp	(original)
+++ trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/user/user-mgt.jsp	Tue Aug 11 04:06:43 2009
@@ -9,7 +9,8 @@
 
 <%@page import="org.wso2.carbon.user.core.UserCoreConstants"%>
 <%@ page import="org.wso2.carbon.user.mgt.common.IUserAdmin" %>
-<script type="text/javascript" src="../userstore/extensions/js/vui.js"></script>
+
+<%@page import="org.wso2.carbon.user.mgt.common.UserStoreInfo"%><script type="text/javascript" src="../userstore/extensions/js/vui.js"></script>
 <script type="text/javascript" src="../admin/js/main.js"></script>
 <jsp:include page="../dialog/display_messages.jsp"/>
 <title>WSO2 Carbon - Security Configuration</title>
@@ -31,6 +32,8 @@
 	   session.setAttribute("org.wso2.usermgt.internal.filter", filter);
     }
 		
+    UserStoreInfo userStoreInfo = null;
+    userStoreInfo = (UserStoreInfo)session.getAttribute(UserAdminClient.USER_STORE_INFO);
     try {
         String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
         String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
@@ -40,6 +43,10 @@
             (IUserAdmin) CarbonUIUtil.
                     getServerProxy(new UserAdminClient(cookie, backendServerURL, configContext),
                                          IUserAdmin.class, session);
+        if(userStoreInfo == null){
+            userStoreInfo = proxy.getUserStoreInfo();
+            session.setAttribute(UserAdminClient.USER_STORE_INFO, userStoreInfo);
+        }
         if(filter.length() > 0){
             datas = proxy.listUsers(filter);
             if(datas == null || datas.length == 0){
@@ -120,15 +127,21 @@
                     <td><%=data%>
                     </td>
                     <td>
-                        <a href="change-passwd.jsp?username=<%=data%>" class="icon-link" style="background-image:url(../admin/images/edit.gif);"><fmt:message key="change.password"/></a>
                         <%
-				        	if(CarbonUIUtil.isContextRegistered(config, "/userprofile/")){
-				        %>
-				        <a href="../userprofile/index.jsp?username=<%=data%>&userstore=<%=UserCoreConstants.INTERNAL_USERSTORE%>" class="icon-link" style="background-image:url(../userprofile/images/my-prof.gif);">User Profile</a>
-				        <%
-				            }
-				        %>    
-                        <a href="#" onclick="deleteUser('<%=data%>')" class="icon-link" style="background-image:url(images/delete.gif);"><fmt:message key="delete"/></a>                       
+                        if(userStoreInfo.isReadOnly() == false){
+                        %>
+	                        <a href="change-passwd.jsp?username=<%=data%>" class="icon-link" style="background-image:url(../admin/images/edit.gif);"><fmt:message key="change.password"/></a>
+	                        <%
+					        	if(CarbonUIUtil.isContextRegistered(config, "/userprofile/")){
+					        %>
+					        <a href="../userprofile/index.jsp?username=<%=data%>&userstore=<%=UserCoreConstants.INTERNAL_USERSTORE%>" class="icon-link" style="background-image:url(../userprofile/images/my-prof.gif);">User Profile</a>
+					        <%
+					            }
+					        %>    
+	                        <a href="#" onclick="deleteUser('<%=data%>')" class="icon-link" style="background-image:url(images/delete.gif);"><fmt:message key="delete"/></a>
+                        <%
+                        }
+                        %>                       
 
         </td>
                 </tr>
@@ -159,6 +172,9 @@
                   }
               }
              %>
+             <%
+             if(userStoreInfo.isReadOnly() == false){
+             %>
         <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top:2px;">
             <tr>
                 <td class="addNewSecurity">
@@ -166,6 +182,9 @@
 </td>
             </tr>
         </table>
+            <%
+             }
+            %>
     </div>
     </div>
     <script language="text/JavaScript">

Modified: trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/index.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/index.jsp?rev=43096&r1=43095&r2=43096&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/index.jsp	(original)
+++ trunk/carbon/org.wso2.carbon.user.mgt.ui/src/main/resources/web/userstore/index.jsp	Tue Aug 11 04:06:43 2009
@@ -46,8 +46,10 @@
                     (IUserAdmin) CarbonUIUtil.
                     getServerProxy(new UserAdminClient(cookie, backendServerURL, configContext),
                                          IUserAdmin.class, session);
-                userStoreInfo = proxy.getUserStoreInfo();
-                session.setAttribute(UserAdminClient.USER_STORE_INFO, userStoreInfo);
+                if(userStoreInfo == null){
+                    userStoreInfo = proxy.getUserStoreInfo();
+                    session.setAttribute(UserAdminClient.USER_STORE_INFO, userStoreInfo);
+                }
             }
         }catch(Exception e){
             CarbonUIMessage uiMsg = new CarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, e);

Modified: trunk/carbon/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/UserAdmin.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/UserAdmin.java?rev=43096&r1=43095&r2=43096&view=diff
==============================================================================
--- trunk/carbon/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/UserAdmin.java	(original)
+++ trunk/carbon/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/UserAdmin.java	Tue Aug 11 04:06:43 2009
@@ -333,12 +333,13 @@
             UserRealm defRealm = UserMgtContext.getDefaultRealm();
             UserStoreManager admin = defRealm.getUserStoreManager();
             String[] oldUserList = admin.getUserListOfRole(roleName);
-
+            Arrays.sort(oldUserList);
+            
             List<String> delUsers = new ArrayList<String>();
             List<String> addUsers = new ArrayList<String>();
 
             for (FlaggedName fName : userList) {
-                boolean isSelected = fName.isHybridItem();
+                boolean isSelected = fName.isSelected();
                 String userName = fName.getItemName();
                 int oldindex = Arrays.binarySearch(oldUserList, userName);
                 if (oldindex > -1 && isSelected == false) {



More information about the Carbon-dev mailing list