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