[Registry-dev] svn commit r10065 - in
trunk/registry/modules/webapps: conf
src/main/java/org/wso2/registry/web/actions
src/main/webapp/admin/tiles
svn at wso2.org
svn at wso2.org
Wed Nov 21 23:15:24 PST 2007
Author: chathura
Date: Wed Nov 21 23:15:08 2007
New Revision: 10065
Added:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AddUserRoleAction.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RemoveUserRoleAction.java
Modified:
trunk/registry/modules/webapps/conf/package.properties
trunk/registry/modules/webapps/conf/registry.xml
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/UserDetailsAction.java
trunk/registry/modules/webapps/src/main/webapp/admin/tiles/header.jsp
trunk/registry/modules/webapps/src/main/webapp/admin/tiles/user.jsp
Log:
Integrating more back-end functionality in to the user page.
Modified: trunk/registry/modules/webapps/conf/package.properties
==============================================================================
--- trunk/registry/modules/webapps/conf/package.properties (original)
+++ trunk/registry/modules/webapps/conf/package.properties Wed Nov 21 23:15:08 2007
@@ -48,13 +48,13 @@
label.btn.Submit = Submit
#links
-link.Home = Home
+link.Home = Resources
link.signin = Sign in
link.signout = Sign out
link.signup = Sign up
link.AdvanceSearch = Advanced search
-link.usermanagement = User Management
-link.RecentActivity=Recent activity
+link.usermanagement = People
+link.RecentActivity= Activity
#Messages
message.Signout = You have not signed in.
Modified: trunk/registry/modules/webapps/conf/registry.xml
==============================================================================
--- trunk/registry/modules/webapps/conf/registry.xml (original)
+++ trunk/registry/modules/webapps/conf/registry.xml Wed Nov 21 23:15:08 2007
@@ -137,6 +137,20 @@
</result>
</action>
+ <action name="AddUserRole" class="org.wso2.registry.web.actions.AddUserRoleAction">
+ <result name="success" type="redirect-action">
+ <param name="actionName">UserDetails.action</param>
+ <param name="userName">${userName}</param>
+ </result>
+ </action>
+
+ <action name="RemoveUserRole" class="org.wso2.registry.web.actions.RemoveUserRoleAction">
+ <result name="success" type="redirect-action">
+ <param name="actionName">UserDetails.action</param>
+ <param name="userName">${userName}</param>
+ </result>
+ </action>
+
<!--
<action name="ResourceDetails" class="org.wso2.registry.ui.actions.ArtifactDetailsAction">
<result name="success">/admin/tiles/resources_general.jsp</result>
Added: trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AddUserRoleAction.java
==============================================================================
--- (empty file)
+++ trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AddUserRoleAction.java Wed Nov 21 23:15:08 2007
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.registry.web.actions;
+
+import org.wso2.registry.secure.SecureRegistry;
+import org.wso2.usermanager.Realm;
+import com.opensymphony.xwork2.ActionSupport;
+
+public class AddUserRoleAction extends AbstractRegistryAction {
+
+ private String userName;
+ private String roleName;
+
+ public String execute() throws Exception {
+
+ if (roleName.equals("1")) {
+ return ActionSupport.SUCCESS;
+ }
+
+ SecureRegistry registry = (SecureRegistry) getRegistry();
+ Realm realm = registry.getUserManager().getRealm();
+
+ realm.getUserStoreAdmin().addUserToRole(userName, roleName);
+
+ return ActionSupport.SUCCESS;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getRoleName() {
+ return roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+}
Added: trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RemoveUserRoleAction.java
==============================================================================
--- (empty file)
+++ trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RemoveUserRoleAction.java Wed Nov 21 23:15:08 2007
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2006, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.registry.web.actions;
+
+import org.wso2.registry.secure.SecureRegistry;
+import org.wso2.usermanager.Realm;
+import com.opensymphony.xwork2.ActionSupport;
+
+public class RemoveUserRoleAction extends AbstractRegistryAction {
+
+ private String userName;
+ private String roleName;
+
+ public String execute() throws Exception {
+
+ SecureRegistry registry = (SecureRegistry) getRegistry();
+ Realm realm = registry.getUserManager().getRealm();
+
+ realm.getUserStoreAdmin().removeUserFromRole(userName, roleName);
+
+ return ActionSupport.SUCCESS;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getRoleName() {
+ return roleName;
+ }
+
+ public void setRoleName(String roleName) {
+ this.roleName = roleName;
+ }
+}
Modified: trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/UserDetailsAction.java
==============================================================================
--- trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/UserDetailsAction.java (original)
+++ trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/UserDetailsAction.java Wed Nov 21 23:15:08 2007
@@ -23,10 +23,13 @@
import java.util.List;
import java.util.ArrayList;
+import com.opensymphony.xwork2.ActionSupport;
+
public class UserDetailsAction extends AbstractRegistryAction {
private String userName;
private List userRoles = new ArrayList();
+ private List allRoles = new ArrayList();
public String execute() throws Exception {
@@ -39,7 +42,12 @@
userRoles.add(rolesArray[i]);
}
- return super.execute(); //To change body of overridden methods use File | Settings | File Templates.
+ String[] roleNamesArray = userManager.getAllRoles();
+ for (int i = 0; i < roleNamesArray.length; i++) {
+ allRoles.add(roleNamesArray[i]);
+ }
+
+ return ActionSupport.SUCCESS;
}
public String getUserName() {
@@ -57,4 +65,12 @@
public void setUserRoles(List userRoles) {
this.userRoles = userRoles;
}
+
+ public List getAllRoles() {
+ return allRoles;
+ }
+
+ public void setAllRoles(List allRoles) {
+ this.allRoles = allRoles;
+ }
}
Modified: trunk/registry/modules/webapps/src/main/webapp/admin/tiles/header.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/tiles/header.jsp (original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/tiles/header.jsp Wed Nov 21 23:15:08 2007
@@ -2,6 +2,6 @@
<div id="banner"><table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td><img src="images/logo.gif" /></td>
- <td align="right" valign="bottom"><a href="Resources.action"><s:text name="link.Home"/></a> | <a href="RecentActivity.action"><s:text name="link.RecentActivity"/></a> | <a href="UserManagement.action"><s:text name="link.usermanagement"/></a> |<a href="SignOut.action"><s:text name="link.signout"/></a></td>
+ <td align="right" valign="bottom"><a href="Resources.action"><s:text name="link.Home"/></a> | <a href="UserManagement.action"><s:text name="link.usermanagement"/></a> | <a href="RecentActivity.action"><s:text name="link.RecentActivity"/></a> |<a href="SignOut.action"><s:text name="link.signout"/></a></td>
</tr>
</table></div>
Modified: trunk/registry/modules/webapps/src/main/webapp/admin/tiles/user.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/tiles/user.jsp (original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/tiles/user.jsp Wed Nov 21 23:15:08 2007
@@ -24,20 +24,18 @@
</s:iterator>
</ul>
-<div class="detail-section">
- <strong>Add user to role</strong>
-
- <s:form name="frmTag" action='AddUserRole.action' theme="simple" >
- <s:hidden name="userName" value="%{userName}" />
- <s:select label="Role"
- name="userToAuthorize"
- headerKey="1"
- headerValue="-- Please Select --"
- list="userNames"/>
- <s:submit value="Add" />
- </s:form>
+<br/>
+<strong>Add user to role</strong>
-</div><br/>
+<s:form name="frmAddUserRole" action='AddUserRole.action' theme="simple" >
+ <s:hidden name="userName" value="%{userName}" />
+ <s:select label="Role"
+ name="roleName"
+ headerKey="1"
+ headerValue="-- Select a Role --"
+ list="allRoles"/>
+ <s:submit value="Add" />
+</s:form>
<br><br>
More information about the Registry-dev
mailing list