RoleSet groupRoles = getRoles(user, group);
// put the Set into roles(group)
roles.put(group, groupRoles);
// collect all permissoins in this group
PermissionSet groupPermissions = new PermissionSet();
// foreach role in Set
Iterator rolesIterator = groupRoles.iterator();
while (rolesIterator.hasNext())
{
Role role = (Role) rolesIterator.next();
// get permissions of the role
PermissionSet rolePermissions = getPermissions(role);
groupPermissions.add(rolePermissions);
}
// put the Set into permissions(group)
permissions.put(group, groupPermissions);