portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r412805 - in /portals/jetspeed-2/trunk/applications/j2-admin/src: java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java webapp/WEB-INF/security/permissions/view.vm
Date Thu, 08 Jun 2006 17:18:10 GMT
Author: taylor
Date: Thu Jun  8 10:18:09 2006
New Revision: 412805

URL: http://svn.apache.org/viewvc?rev=412805&view=rev
Log:
provide roles 

Modified:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java?rev=412805&r1=412804&r2=412805&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
(original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
Thu Jun  8 10:18:09 2006
@@ -34,6 +34,7 @@
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.security.PermissionManager;
 import org.apache.jetspeed.security.om.InternalPermission;
+import org.apache.jetspeed.security.om.InternalPrincipal;
 import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
 import org.apache.velocity.context.Context;
 
@@ -108,24 +109,24 @@
             Iterator all = pm.getPermissions();
             while (all.hasNext())
             {
-                InternalPermission permission = (InternalPermission)all.next();
+                InternalPermission permission = (InternalPermission)all.next();         
      
                 if (permission.getClassname().equals(CLASSNAMES[0]))
                 {
-                    folders.add(permission);                    
+                    folders.add(new PermissionData(permission));                    
                 }
                 else if (permission.getClassname().equals(CLASSNAMES[1]))
                 {
-                    pages.add(permission);
+                    pages.add(new PermissionData(permission));
                 }
                 else if (permission.getClassname().equals(CLASSNAMES[2]))
                 {
-                    portlets.add(permission);
-                }
-                folderPermissions = folders.iterator();
-                pagePermissions = pages.iterator();
-                portletPermissions = portlets.iterator();
-            }            
-        }
+                    portlets.add(new PermissionData(permission));
+                }                
+            }
+            folderPermissions = folders.iterator();
+            pagePermissions = pages.iterator();
+            portletPermissions = portlets.iterator();            
+        }        
         context.put("folderPermissions", folderPermissions);
         context.put("pagePermissions", pagePermissions);
         context.put("portletPermissions", portletPermissions);
@@ -138,4 +139,55 @@
         //session.setAttribute(SESSION_RESULTS, stats);
     }
 
+    public class PermissionData
+    {
+        public PermissionData(InternalPermission permission)
+        {
+            this.permission = permission;
+            this.roles = ""; 
+            int size = permission.getPrincipals().size(); 
+            if (size == 0)
+            {
+                return;
+            }
+            Iterator principals = permission.getPrincipals().iterator();
+            int count = 0;
+            StringBuffer result = new StringBuffer();
+            while (principals.hasNext())
+            {
+                InternalPrincipal principal = (InternalPrincipal)principals.next();
+                int last = principal.getFullPath().lastIndexOf("/") + 1;
+                result.append(principal.getFullPath().substring(last));            
+                count++;
+                if (count < size)
+                {
+                    result.append(",");
+                }
+            }
+            this.roles = result.toString();
+        }
+        
+        InternalPermission permission;
+        String roles;
+        
+        public InternalPermission getPermission()
+        {
+            return permission;
+        }
+        
+        public void setPermission(InternalPermission permission)
+        {
+            this.permission = permission;
+        }
+        
+        public String getRoles()
+        {
+            return roles;
+        }
+        
+        public void setRoles(String roles)
+        {
+            this.roles = roles;
+        }
+    }
 }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm?rev=412805&r1=412804&r2=412805&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm
(original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm
Thu Jun  8 10:18:09 2006
@@ -80,11 +80,12 @@
 <tr>
     <th field="name" dataType="String">Resource</th>
     <th field="actions" dataType="String">Actions</th>
+    <th field="roles" dataType="String">Roles</th>        
 </tr>
 </thead>
 <tbody>
-#foreach($permission in $portletPermissions)
-<tr><td>$permission.Name</td><td>$permission.Actions</td></tr>
+#foreach($p in $portletPermissions)
+<tr><td>$p.Permission.Name</td><td>$p.Permission.Actions</td><td>$p.Roles</td></tr>
 #end
 </tbody>
 </table>
@@ -95,11 +96,12 @@
 <tr>
     <th field="name" dataType="String">Resource</th>
     <th field="actions" dataType="String">Actions</th>
+    <th field="roles" dataType="String">Roles</th>        
 </tr>
 </thead>
 <tbody>
-#foreach($permission in $folderPermissions)
-<tr><td>$permission.Name</td><td>$permission.Actions</td></tr>
+#foreach($p in $folderPermissions)
+<tr><td>$p.Permission.Name</td><td>$p.Permission.Actions</td><td>$p.Roles</td></tr>
 #end
 </tbody>
 </table>
@@ -110,11 +112,12 @@
 <tr>
     <th field="name" dataType="String">Resource</th>
     <th field="actions" dataType="String">Actions</th>
+    <th field="roles" dataType="String">Roles</th>    
 </tr>
 </thead>
 <tbody>
-#foreach($permission in $pagePermissions)
-<tr><td>$permission.Name</td><td>$permission.Actions</td></tr>
+#foreach($p in $pagePermissions)
+<tr><td>$p.Permission.Name</td><td>$p.Permission.Actions</td><td>$p.Roles</td></tr>
 #end
 </tbody>
 </table>
@@ -147,6 +150,8 @@
 function processTableRowEvent(e, tableName)
 {
     alert( tableName + ", " + e.currentTarget.cells.item(0).innerHTML ); 
+    alert( tableName + ", " + e.currentTarget.cells.item(1).innerHTML ); 
+    alert( tableName + ", " + e.currentTarget.cells.item(2).innerHTML ); 
 }
 function addTableRowSelectListener()
 {



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message