jford       2004/06/25 08:50:24

  Modified:    src/java/org/apache/jetspeed/services/security
                        SecurityCacheImpl.java
  Log:
  Fixed security cache issue

  

  Added method for removing a group from the system
  
  Revision  Changes    Path
  1.11      +33 -4     
jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/SecurityCacheImpl.java
  
  Index: SecurityCacheImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/security/SecurityCacheImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SecurityCacheImpl.java    23 Feb 2004 03:58:11 -0000      1.10
  +++ SecurityCacheImpl.java    25 Jun 2004 15:50:24 -0000      1.11
  @@ -24,6 +24,7 @@
   import javax.servlet.ServletConfig;
   
   import org.apache.jetspeed.om.security.Group;
  +import org.apache.jetspeed.om.security.GroupRole;
   import org.apache.jetspeed.om.security.Permission;
   import org.apache.jetspeed.om.security.Role;
   import org.apache.jetspeed.services.JetspeedSecurity;
  @@ -161,11 +162,17 @@
                return false;
        }
   
  +    /**
  +     * This method is called to remove a role from a user's acl in the default group
  +     */
        public void removeRole(String username, String roleName)
        {
                removeRole(username, roleName, GroupManagement.DEFAULT_GROUP_NAME);
        }
   
  +     /**
  +      * This method is called to remove a role from a user's acl in the specified 
group
  +      */
        public void removeRole(String username, String roleName, String groupName)
        {
                CachedAcl acl = (CachedAcl) acls.get(username);
  @@ -173,8 +180,6 @@
                {
                        acl.removeRole(roleName, groupName);
                }
  -             // TODO: Why do this?
  -             perms.remove(roleName);
        }
   
       public CachedAcl getAcl(String username)
  @@ -241,7 +246,10 @@
           return null;
       }
   
  -
  +    /**
  +     * This method is called when a role has been removed from the system.  
  +     * All cached acls will have the role removed. 
  +     */
       public void removeAllRoles(String rolename)
       {
           Iterator iterator = acls.values().iterator();
  @@ -307,6 +315,27 @@
   
           setInit(true);
        }
  +
  +    /** 
  +     * @see 
org.apache.jetspeed.services.security.SecurityCacheService#removeGroup(java.lang.String)
  +     */
  +    public void removeAllGroups(String groupName)
  +     {
  +     Iterator valueIter = acls.values().iterator();
  +        while (valueIter.hasNext())
  +        {
  +            CachedAcl acl = (CachedAcl) valueIter.next();
  +            Iterator roleIter = acl.getRoles();
  +            while (roleIter.hasNext())
  +            {
  +                GroupRole groupRole = (GroupRole) roleIter.next();
  +                if(groupRole.getGroup().getName().equals(groupName))
  +                {
  +                    roleIter.remove();
  +                 }
  +             }
  +        }
  +     }
   
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to