Update of 
/var/cvs/contributions/CMSContainer/cmsc/security/src/java/com/finalist/cmsc/security
In directory 
james.mmbase.org:/tmp/cvs-serv28360/cmsc/security/src/java/com/finalist/cmsc/security

Modified Files:
        SecurityUtil.java 
Log Message:
CMSC-973, it will now correctly merge the rights of multiple groups.



See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/security/src/java/com/finalist/cmsc/security
See also: http://www.mmbase.org/jira/browse/CMSC-973


Index: SecurityUtil.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/security/src/java/com/finalist/cmsc/security/SecurityUtil.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- SecurityUtil.java   16 May 2008 11:46:34 -0000      1.13
+++ SecurityUtil.java   26 Jun 2008 16:38:16 -0000      1.14
@@ -154,21 +154,30 @@
                            Node extraGroup = groups.getNode(i);
                            fillChannelsWithRole(extraGroup, extraRoles, 
treeManagers, relationName);
 
+                  // upgrade user role map based on the data of the new group 
data map
                            for (Map.Entry<String, UserRole> entry : 
channelsWithRole.entrySet()) {
                                String path = entry.getKey();
-                               UserRole channelRole = entry.getValue();
-                               UserRole extraRole = getRole(path, extraRoles);
-                               if (extraRole != null && 
channelRole.getRole().getId() < extraRole.getRole().getId()) {
-                                   channelsWithRole.put(path, extraRole);
+                     UserRole userRole = entry.getValue();
+                     UserRole newGroupRole = getRole(path, extraRoles);
+                     if (newGroupRole != null && userRole.getRole().getId() < 
newGroupRole.getRole().getId()) {
+                         channelsWithRole.put(path, newGroupRole);
                                }
                            }
 
+                 // add missing data to user role map based on new group data 
map
                            for (Map.Entry<String, UserRole> entry : 
extraRoles.entrySet()) {
                                String extraPath = entry.getKey();
-                               UserRole extraRole = entry.getValue();
+                     UserRole newGroupRole = entry.getValue();
                                UserRole channelRole = getRole(extraPath, 
channelsWithRole);
-                               if (channelRole != null && 
channelRole.getRole().getId() < extraRole.getRole().getId()) {
-                                   channelsWithRole.put(extraPath, extraRole);
+                     Role userRole;
+                     if (channelRole == null) {
+                        userRole = Role.NONE;
+                     }
+                     else {
+                        userRole = channelRole.getRole();
+                     }
+                     if (userRole.getId() < newGroupRole.getRole().getId()) {
+                         channelsWithRole.put(extraPath, newGroupRole);
                                }
                            }
                        }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to