Author: chathura
Date: Tue Dec  4 22:07:36 2007
New Revision: 10509

Log:


Integrated role authorization view and changing functionality to the UI.



Added:
   
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/MassRoleAuthorizationAction.java
   
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RoleAuthorizationAction.java
Modified:
   
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
   
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
   trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
   trunk/registry/modules/webapps/src/main/webapp/admin/permisions.jsp
   trunk/registry/modules/webapps/src/main/webapp/admin/search.jsp

Modified: 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
==============================================================================
--- 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
   (original)
+++ 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/ControllerServlet.java
   Tue Dec  4 22:07:36 2007
@@ -168,6 +168,36 @@
 
                 forwardToResources(request, response, path);
 
+            } else if (command.equals("/authorizeRole")) {
+
+                RoleAuthorizationAction roleAuthorizationAction = new 
RoleAuthorizationAction();
+                roleAuthorizationAction.setPathToAuthorize(path);
+                
roleAuthorizationAction.setRoleToAuthorize(request.getParameter("roleToAuthorize"));
+                
roleAuthorizationAction.setActionToAuthorize(request.getParameter("actionToAuthorize"));
+                
roleAuthorizationAction.setPermissionType(request.getParameter("permissionType"));
+
+                try {
+                    roleAuthorizationAction.execute(request);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+                forwardToResources(request, response, path);
+
+            } else if (command.equals("/authorizeRoles")) {
+
+                MassRoleAuthorizationAction massRoleAuthorizationAction = new 
MassRoleAuthorizationAction();
+                massRoleAuthorizationAction.setResourcePath(path);
+                
massRoleAuthorizationAction.setPermissionString(request.getParameter("permissionInput"));
+
+                try {
+                    massRoleAuthorizationAction.execute(request);
+                } catch (RegistryException e) {
+                    e.printStackTrace();
+                }
+
+                forwardToResources(request, response, path);
+
             } else if (command.equals("/addComment")) {
 
                 CommentAction commentAction = new CommentAction();

Added: 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/MassRoleAuthorizationAction.java
==============================================================================
--- (empty file)
+++ 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/MassRoleAuthorizationAction.java
 Tue Dec  4 22:07:36 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.RegistryException;
+import org.wso2.registry.ActionConstants;
+import org.wso2.registry.secure.SecureRegistry;
+import org.wso2.registry.secure.RegistryUserManager;
+import org.wso2.usermanager.Realm;
+import org.wso2.usermanager.AccessControlAdmin;
+import org.wso2.usermanager.UserManagerException;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class MassRoleAuthorizationAction extends AbstractRegistryAction {
+
+    private String resourcePath;
+    private String permissionString;
+
+    public void execute(HttpServletRequest request) throws RegistryException {
+
+        setRequest(request);
+
+        SecureRegistry secureRegistry = (SecureRegistry) getRegistry();
+        RegistryUserManager userManager = secureRegistry.getUserManager();
+        Realm realm = userManager.getRealm();
+
+        AccessControlAdmin accessControlAdmin = null;
+        try {
+            accessControlAdmin = realm.getAccessControlAdmin();
+        } catch (UserManagerException e) {
+            String msg = "Couldn't get access control admin for changing 
authorizations. Caused by: " + e.getMessage();
+            throw new RegistryException(msg);
+        }
+
+        try {
+
+            String[] rolePermissions = permissionString.split("1");
+            for (int i = 0; i < rolePermissions.length; i++) {
+                String[] permissions = rolePermissions[i].split("2");
+                String permRole = permissions[0];
+                accessControlAdmin.clearRoleAuthorization(permRole, 
resourcePath, ActionConstants.GET);
+                accessControlAdmin.clearRoleAuthorization(permRole, 
resourcePath, ActionConstants.PUT);
+
+                for (int j = 1; j < permissions.length; j++) {
+                    String[] permission = permissions[j].split("3");
+
+                    String action = permission[0];
+                    String checked = permission[1];
+
+                    if (action.equals("ra")) {
+                        if (checked.equals("true")) {
+                            accessControlAdmin.authorizeRole(permRole, 
resourcePath, ActionConstants.GET);
+                        }
+                    } else if (action.equals("rd")) {
+                        if (checked.equals("true")) {
+                            accessControlAdmin.denyRole(permRole, 
resourcePath, ActionConstants.GET);
+                        }
+                    } else if (action.equals("wa")) {
+                        if (checked.equals("true")) {
+                            accessControlAdmin.authorizeRole(permRole, 
resourcePath, ActionConstants.PUT);
+                        }
+                    } else if (action.equals("wd")) {
+                        if (checked.equals("true")) {
+                            accessControlAdmin.denyRole(permRole, 
resourcePath, ActionConstants.PUT);
+                        }
+                    }
+                }
+            }
+        } catch (UserManagerException e) {
+            String msg = "Couldn't set authorizations. Caused by: " + 
e.getMessage();
+            throw new RegistryException(msg);
+        }
+    }
+
+    public String getResourcePath() {
+        return resourcePath;
+    }
+
+    public void setResourcePath(String resourcePath) {
+        this.resourcePath = resourcePath;
+    }
+
+    public String getPermissionString() {
+        return permissionString;
+    }
+
+    public void setPermissionString(String permissionString) {
+        this.permissionString = permissionString;
+    }
+}

Modified: 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
==============================================================================
--- 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
       (original)
+++ 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/ResourceDetailsAction.java
       Tue Dec  4 22:07:36 2007
@@ -45,13 +45,19 @@
     private float averageRating;
     private List versionPaths = new ArrayList();
     private List userPermissions = new ArrayList();
+    private List rolePermissions = new ArrayList();
 
     private String parentPath;
 
     /**
      * Used to populate the users in the userPermissions section
      */
-    private List userNames = new ArrayList();   
+    private List userNames = new ArrayList();
+
+    /**
+     * Used to populate the roles in the rolePermissions section
+     */
+    private List roleNames = new ArrayList();
 
     public String execute(HttpServletRequest request) throws Exception {
 
@@ -152,12 +158,17 @@
 
         Realm realm = userManager.getRealm();
 
+        String[] rolesArray = realm.getUserStoreReader().getAllRoleNames();
+        for (int i = 0; i < rolesArray.length; i++) {
+            roleNames.add(rolesArray[i]);
+        }
+
         if (realm.getAuthorizer().isUserAuthorized(getUserName(), path, 
ActionConstants.PUT)) {
             putAllowed = true;
         }
 
         Map userPermissionMap = new HashMap();
-
+                
         String[] raUsers = 
realm.getAuthorizer().getAllowedUsersForResource(path, ActionConstants.GET);
         for (int i = 0; i < raUsers.length; i++) {
             if (userPermissionMap.containsKey(raUsers[i])) {
@@ -211,6 +222,64 @@
         }
 
         userPermissions = new ArrayList(userPermissionMap.values());
+
+        Map rolePermissionMap = new HashMap();
+
+        String[] raRoles = 
realm.getAuthorizer().getAuthorizedRolesForResource(path, ActionConstants.GET);
+        for (int i = 0; i < raRoles.length; i++) {
+            if (rolePermissionMap.containsKey(raRoles[i])) {
+                Permission permission = (Permission) 
rolePermissionMap.get(raRoles[i]);
+                permission.setReadAllow(true);
+            } else {
+                Permission permission = new Permission();
+                permission.setUserName(raRoles[i]);
+                permission.setReadAllow(true);
+                rolePermissionMap.put(raRoles[i], permission);
+            }
+        }
+
+        // todo: uncomment after user manager adds the method
+        //String[] rdRoles = 
realm.getAuthorizer().getDeniedRolesForResource(path, ActionConstants.GET);
+        //for (int i = 0; i < rdRoles.length; i++) {
+        //    if (rolePermissionMap.containsKey(rdRoles[i])) {
+        //        Permission permission = (Permission) 
rolePermissionMap.get(rdRoles[i]);
+        //        permission.setReadDeny(true);
+        //    } else {
+        //        Permission permission = new Permission();
+        //        permission.setUserName(rdRoles[i]);
+        //        permission.setReadDeny(true);
+        //        rolePermissionMap.put(rdRoles[i], permission);
+        //    }
+        //}
+
+        String[] waRoles = 
realm.getAuthorizer().getAuthorizedRolesForResource(path, ActionConstants.PUT);
+        for (int i = 0; i < waRoles.length; i++) {
+            if (rolePermissionMap.containsKey(waRoles[i])) {
+                Permission permission = (Permission) 
rolePermissionMap.get(waRoles[i]);
+                permission.setWriteAllow(true);
+            } else {
+                Permission permission = new Permission();
+                permission.setUserName(waRoles[i]);
+                permission.setWriteAllow(true);
+                rolePermissionMap.put(waRoles[i], permission);
+            }
+        }
+
+        // todo: uncomment after user manager adds the method
+        //String[] wdRoles = 
realm.getAuthorizer().getDeniedRolesForResource(path, ActionConstants.PUT);
+        //for (int i = 0; i < wdRoles.length; i++) {
+        //    if (rolePermissionMap.containsKey(wdRoles[i])) {
+        //        Permission permission = (Permission) 
rolePermissionMap.get(wdRoles[i]);
+        //        permission.setWriteDeny(true);
+        //    } else {
+        //        Permission permission = new Permission();
+        //        permission.setUserName(wdRoles[i]);
+        //        permission.setWriteDeny(true);
+        //        rolePermissionMap.put(wdRoles[i], permission);
+        //    }
+        //}
+
+        rolePermissions = new ArrayList(rolePermissionMap.values());
         
         return SUCCESS;
     }
@@ -351,6 +420,14 @@
         this.userNames = userNames;
     }
 
+    public List getRoleNames() {
+        return roleNames;
+    }
+
+    public void setRoleNames(List roleNames) {
+        this.roleNames = roleNames;
+    }
+
     public List getUserPermissions() {
         return userPermissions;
     }
@@ -358,4 +435,12 @@
     public void setUserPermissions(List userPermissions) {
         this.userPermissions = userPermissions;
     }
+
+    public List getRolePermissions() {
+        return rolePermissions;
+    }
+
+    public void setRolePermissions(List rolePermissions) {
+        this.rolePermissions = rolePermissions;
+    }
 }

Added: 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RoleAuthorizationAction.java
==============================================================================
--- (empty file)
+++ 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RoleAuthorizationAction.java
     Tue Dec  4 22:07:36 2007
@@ -0,0 +1,102 @@
+/*
+ * 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.registry.secure.RegistryUserManager;
+import org.wso2.registry.ActionConstants;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class RoleAuthorizationAction extends AbstractRegistryAction {
+
+    private String pathToAuthorize;
+    private String roleToAuthorize;
+
+    private String actionToAuthorize;
+    private String permissionType;
+
+    public String execute(HttpServletRequest request) throws Exception {
+
+        setRequest(request);
+
+        SecureRegistry secureRegistry = (SecureRegistry) getRegistry();
+        RegistryUserManager userManager = secureRegistry.getUserManager();
+
+        if (actionToAuthorize.equals("2")) {
+
+            if (permissionType.equals("1")) {
+                userManager.authorizeRole(roleToAuthorize, pathToAuthorize, 
ActionConstants.GET);
+            } else {
+                userManager.denyRole(roleToAuthorize, pathToAuthorize, 
ActionConstants.GET);
+            }
+        }
+
+        if (actionToAuthorize.equals("3")) {
+
+            if (permissionType.equals("1")) {
+                userManager.authorizeRole(roleToAuthorize, pathToAuthorize, 
ActionConstants.PUT);
+            } else {
+                userManager.denyRole(roleToAuthorize, pathToAuthorize, 
ActionConstants.PUT);
+            }
+        }
+
+        if (actionToAuthorize.equals("4")) {
+
+            if (permissionType.equals("1")) {
+                userManager.authorizeRole(roleToAuthorize, pathToAuthorize, 
ActionConstants.DELETE);
+            } else {
+                userManager.denyRole(roleToAuthorize, pathToAuthorize, 
ActionConstants.DELETE);
+            }
+        }
+
+        return SUCCESS;
+    }
+
+
+    public String getPathToAuthorize() {
+        return pathToAuthorize;
+    }
+
+    public void setPathToAuthorize(String pathToAuthorize) {
+        this.pathToAuthorize = pathToAuthorize;
+    }
+
+    public String getRoleToAuthorize() {
+        return roleToAuthorize;
+    }
+
+    public void setRoleToAuthorize(String roleToAuthorize) {
+        this.roleToAuthorize = roleToAuthorize;
+    }
+
+    public String getActionToAuthorize() {
+        return actionToAuthorize;
+    }
+
+    public void setActionToAuthorize(String actionToAuthorize) {
+        this.actionToAuthorize = actionToAuthorize;
+    }
+
+    public String getPermissionType() {
+        return permissionType;
+    }
+
+    public void setPermissionType(String permissionType) {
+        this.permissionType = permissionType;
+    }
+}

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js   
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/js/common.js   Tue Dec 
 4 22:07:36 2007
@@ -100,10 +100,10 @@
 
 function processPermissions()
 {
-    pForm = document.forms["permissions"];
-    len = pForm.elements.length;
-    msgBody = "";
-    currentUser = "";
+    var pForm = document.forms["permissions"];
+    var len = pForm.elements.length;
+    var msgBody = "";
+    var currentUser = "";
     for (i=0; i<len; i++) {
         if (pForm.elements[i].type=="checkbox") {
             perm = pForm.elements[i];
@@ -120,4 +120,28 @@
 
     document.getElementById("pInput").value = msgBody;
     pForm.submit();
+}
+
+function processRolePermissions()
+{
+    var pForm = document.forms["rolePermissions"];
+    var len = pForm.elements.length;
+    var msgBody = "";
+    var currentUser = "";
+    for (i=0; i<len; i++) {
+        if (pForm.elements[i].type=="checkbox") {
+            perm = pForm.elements[i];
+            if(pForm.elements[i].name.substring(0,7)!="nonuser") {
+                if (currentUser != perm.name) {
+                    msgBody=msgBody + "1" + perm.name + "2" + perm.value + "3" 
+ perm.checked;
+                    currentUser = perm.name;
+                } else {
+                    msgBody=msgBody + "2" + perm.value + "3" + perm.checked;
+                }
+            }
+        }
+    }
+
+    document.getElementById("pRoleInput").value = msgBody;
+    pForm.submit();
 }
\ No newline at end of file

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/permisions.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/permisions.jsp 
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/permisions.jsp Tue Dec 
 4 22:07:36 2007
@@ -8,87 +8,174 @@
     ResourceDetailsAction resource = (ResourceDetailsAction) 
request.getSession().getAttribute(UIConstants.RESOURCE_BEAN);
 %>
 <table width="100%" border="0" cellpadding="5" cellspacing="0" 
bgcolor="#ECECEC">
+    <tr>
+        <form action="/wso2registry/system/authorize" theme="simple" 
method="post">
+            <input type="hidden" name="pathToAuthorize" value="%{path}"/>
+            <td>User</td>
+            <td>
+                <select name="userToAuthorize">
+                    <%
+                        Iterator iUsers = resource.getUserNames().iterator();
+                        while (iUsers.hasNext()) {
+                            String regUser = (String) iUsers.next();
+                    %>
+                    <option value="<%=regUser%>"><%=regUser%></option>
+                    <% } %>
+                </select>
+
+            </td>
+            <td align="right">Action</td>
+            <td>
+                <select name="actionToAuthorize">
+                    <option value="1">-- Select an action --</option>
+                    <option value="2">Read</option>
+                    <option value="3">Write</option>
+                    <option value="4">Delete</option>
+                </select>
+            </td>
+            <td>
+                <input type="radio" name="permissionType" value="1" />Allow 
<input type="radio" name="permissionType" value="2" />Deny
+            </td>
+            <td align="right"><input type="submit" class="button" 
value="Apply"/></td>
+        </form>
+    </tr>
+</table><br>
+
+<form name="permissions" action="/wso2registry/system/authorize/mass" 
theme="simple" method="post">
+    <input type="hidden" id="pInput" name="permissionInput" value=""/>
+    <input type="hidden" name="pathToAuthorize" value="%{path}"/>
+    <table width="100%" class="data-table" border="0" cellpadding="3" 
cellspacing="0">
+        <tr >
+            <th rowspan="2" align="left" >User Name </th>
+            <th colspan="2" align="center">Read</th>
+            <th colspan="2" align="center">Write</th>
+            <th colspan="2" align="center">Delete</th>
+        </tr>
+        <tr>
+            <th align="center">Allow</th>
+            <th align="center">Deny</th>
+            <th align="center">Allow</th>
+            <th align="center">Deny</th>
+            <th align="center">Allow</th>
+            <th align="center">Deny</th>
+        </tr>
+
+        <%
+            Iterator iUserPermissions = 
resource.getUserPermissions().iterator();
+            while (iUserPermissions.hasNext()) {
+                Permission permission = (Permission) iUserPermissions.next();
+        %>
+
+        <tr>
+            <td><%=permission.getUserName()%></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="ra" <% if 
(permission.isReadAllow()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="rd" <% if (permission.isReadDeny()) 
{ %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="wa" <% if 
(permission.isWriteAllow()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="wd" <% if 
(permission.isWriteDeny()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="da" <% if 
(permission.isDeleteAllow()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="dd" <% if 
(permission.isDeleteDeny()) { %> checked <% } %>/></td>
+        </tr>
+        <% } %>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+    </table>
+
+
+    <img src="/wso2registry/admin/images/blank.gif" width="10" height="12" 
/><br/>
+    <input type="submit" class="button" value="Apply All Permissions" 
onclick="processPermissions();" />
+
+</form>
+
+<br/><br/>
+<table width="100%" border="0" cellpadding="5" cellspacing="0" 
bgcolor="#ECECEC">
+    <tr>
+        <form action="/wso2registry/system/authorizeRole" theme="simple" 
method="post">
+            <input type="hidden" name="pathToAuthorize" value="%{path}"/>
+            <td>Role</td>
+            <td>
+                <select name="roleToAuthorize">
+                    <%
+                        Iterator iRoles = resource.getRoleNames().iterator();
+                        while (iRoles.hasNext()) {
+                            String regRole = (String) iRoles.next();
+                    %>
+                    <option value="<%=regRole%>"><%=regRole%></option>
+                    <% } %>
+                </select>
+
+            </td>
+            <td align="right">Action</td>
+            <td>
+                <select name="actionToAuthorize">
+                    <option value="1">-- Select an action --</option>
+                    <option value="2">Read</option>
+                    <option value="3">Write</option>
+                    <option value="4">Delete</option>
+                </select>
+            </td>
+            <td>
+                <input type="radio" name="permissionType" value="1" />Allow 
<input type="radio" name="permissionType" value="2" />Deny
+            </td>
+            <td align="right"><input type="submit" class="button" 
value="Apply"/></td>
+        </form>
+    </tr>
+</table><br>
+
+<form name="rolePermissions" action="/wso2registry/system/authorizeRoles" 
theme="simple" method="post">
+    <input type="hidden" id="pRoleInput" name="permissionInput" value=""/>
+    <input type="hidden" name="pathToAuthorize" value="%{path}"/>
+    <table width="100%" class="data-table" border="0" cellpadding="3" 
cellspacing="0">
+        <tr >
+            <th rowspan="2" align="left" >Role Name </th>
+            <th colspan="2" align="center">Read</th>
+            <th colspan="2" align="center">Write</th>
+            <th colspan="2" align="center">Delete</th>
+        </tr>
         <tr>
-            <form action="/wso2registry/system/authorize" theme="simple" 
method="post">
-                <input type="hidden" name="pathToAuthorize" value="%{path}"/>
-                <td>User</td>
-                <td>
-                       <select name="userToAuthorize">
-                        <%
-                            Iterator iUsers = 
resource.getUserNames().iterator();
-                            while (iUsers.hasNext()) {
-                                String regUser = (String) iUsers.next();
-                        %>
-                        <option value="<%=regUser%>"><%=regUser%></option>
-                        <% } %>
-                       </select>
-                
-                </td>
-                <td align="right">Action</td>
-                <td>
-                       <select name="actionToAuthorize">
-                               <option value="1">-- Select an action 
--</option>
-                               <option value="2">Read</option>
-                               <option value="3">Write</option>
-                               <option value="4">Delete</option>
-                       </select>
-                </td>
-                <td>
-                       <input type="radio" name="permissionType" value="1" 
/>Allow <input type="radio" name="permissionType" value="2" />Deny
-                </td>
-                <td align="right"><input type="submit" class="button" 
value="Apply"/></td>
-            </form>
-        </tr>
-    </table><br>
-
-    <form name="permissions" action="/wso2registry/system/authorize/mass" 
theme="simple" method="post">
-        <input type="hidden" id="pInput" name="permissionInput" value=""/>
-        <input type="hidden" name="pathToAuthorize" value="%{path}"/>
-        <table width="100%" class="data-table" border="0" cellpadding="3" 
cellspacing="0">
-            <tr >
-                <th rowspan="2" align="left" >User Name </th>
-                <th colspan="2" align="center">Read</th>
-                <th colspan="2" align="center">Write</th>
-                <th colspan="2" align="center">Delete</th>
-            </tr>
-            <tr>
-                <th align="center">Allow</th>
-                <th align="center">Deny</th>
-                <th align="center">Allow</th>
-                <th align="center">Deny</th>
-                <th align="center">Allow</th>
-                <th align="center">Deny</th>
-            </tr>
-
-            <%
-                Iterator iUserPermissions = 
resource.getUserPermissions().iterator();
-                while (iUserPermissions.hasNext()) {
-                    Permission permission = (Permission) 
iUserPermissions.next();
-            %>
-
-                <tr>
-                    <td><%=permission.getUserName()%></td>
-                    <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="ra" <% if 
(permission.isReadAllow()) { %> checked <% } %>/></td>
-                    <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="rd" <% if (permission.isReadDeny()) 
{ %> checked <% } %>/></td>
-                    <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="wa" <% if 
(permission.isWriteAllow()) { %> checked <% } %>/></td>
-                    <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="wd" <% if 
(permission.isWriteDeny()) { %> checked <% } %>/></td>
-                    <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="da" <% if 
(permission.isDeleteAllow()) { %> checked <% } %>/></td>
-                    <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="dd" <% if 
(permission.isDeleteDeny()) { %> checked <% } %>/></td>
-                </tr>
-            <% } %>
-            <tr>
-                <td>&nbsp;</td>
-                <td>&nbsp;</td>
-                <td>&nbsp;</td>
-                <td>&nbsp;</td>
-                <td>&nbsp;</td>
-                <td>&nbsp;</td>
-                <td>&nbsp;</td>
-            </tr>
-        </table>
+            <th align="center">Allow</th>
+            <th align="center">Deny</th>
+            <th align="center">Allow</th>
+            <th align="center">Deny</th>
+            <th align="center">Allow</th>
+            <th align="center">Deny</th>
+        </tr>
+
+        <%
+            Iterator iRolePermissions = 
resource.getRolePermissions().iterator();
+            while (iRolePermissions.hasNext()) {
+                Permission permission = (Permission) iRolePermissions.next();
+        %>
+
+        <tr>
+            <td><%=permission.getUserName()%></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="ra" <% if 
(permission.isReadAllow()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="rd" <% if (permission.isReadDeny()) 
{ %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="wa" <% if 
(permission.isWriteAllow()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="wd" <% if 
(permission.isWriteDeny()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="da" <% if 
(permission.isDeleteAllow()) { %> checked <% } %>/></td>
+            <td width="100"><input type="checkbox" 
name="<%=permission.getUserName()%>" value="dd" <% if 
(permission.isDeleteDeny()) { %> checked <% } %>/></td>
+        </tr>
+        <% } %>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+    </table>
 
 
-        <img src="/wso2registry/admin/images/blank.gif" width="10" height="12" 
/><br/>
-        <input type="submit" class="button" value="Apply All Permissions" 
onclick="processPermissions();" />
+    <img src="/wso2registry/admin/images/blank.gif" width="10" height="12" 
/><br/>
+    <input type="submit" class="button" value="Apply All Permissions" 
onclick="processRolePermissions();" />
 
-    </form>
+</form>

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/search.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/search.jsp     
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/search.jsp     Tue Dec 
 4 22:07:36 2007
@@ -1,4 +1,3 @@
-<%@ page import="org.wso2.registry.web.actions.AdvancedSearchAction" %>
 <%@ page import="org.wso2.registry.web.UIConstants" %>
 <%@ page import="java.util.List" %>
 <%@ page import="java.util.Iterator" %>

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

Reply via email to