in extensions/torque/src/java/org/apache/turbine/services/security/torque/TorqueSecurityService.java [107:161]
public AccessControlList getACL(User user)
throws DataBackendException, UnknownEntityException
{
if (!TurbineSecurity.accountExists(user))
{
throw new UnknownEntityException("The account '"
+ user.getName() + "' does not exist");
}
try
{
Hashtable roles = new Hashtable();
Hashtable permissions = new Hashtable();
// notify the state modifiers (writers) that we want to create
// the snapshot.
lockShared();
// construct the snapshot:
// foreach group in the system
for (Iterator groupsIterator = getAllGroups().iterator();
groupsIterator.hasNext();)
{
Group group = (Group) groupsIterator.next();
// 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);
}
return getAclInstance(roles, permissions);
}
catch (Exception e)
{
throw new DataBackendException("Failed to build ACL for user '" +
user.getName() + "'" , e);
}
finally
{
// notify the state modifiers that we are done creating the snapshot.
unlockShared();
}
}