in api/src/java/org/apache/fulcrum/security/model/turbine/TurbineAccessControlListImpl.java [102:167]
public TurbineAccessControlListImpl(
Set<? extends TurbineUserGroupRole> turbineUserGroupRoleSet,
GroupManager groupManager, RoleManager roleManager, TurbineModelManager modelManager, Logger logger) throws FulcrumSecurityException
{
this.roleSets = new HashMap<Group, RoleSet>();
this.permissionSets = new HashMap<Group, PermissionSet>();
this.groupManager = groupManager;
this.logger = logger;
for (TurbineUserGroupRole ugr : turbineUserGroupRoleSet)
{
Group group = ugr.getGroup();
// check if group matches
if (this.logger != null && this.groupManager != null && group.getClass() != this.groupManager.getGroupInstance().getClass()) {
this.logger.warn( "Turbine group classes do not match, some lookup might fail, check in componentConfiguration.xml. Expected class: " +
this.groupManager.getGroupInstance().getClass() + ", actual class: " +group.getClass()
);
}
groupSet.add(group);
Role role = ugr.getRole();
if (!roleSet.containsId(role.getId()))
{
// get fresh reference from role manager to make sure the related
// permissions are populated
if (roleManager != null)
{
role = roleManager.getRoleById(role.getId());
}
roleSet.add(role);
}
else
{
role = roleSet.getById(role.getId());
}
if (roleSets.containsKey(group))
{
roleSets.get(group).add(role);
}
else
{
RoleSet rs = new RoleSet();
rs.add(role);
roleSets.put(group, rs);
}
// if required, otherwise skip
if (role instanceof TurbineRole) {
PermissionSet ps = ((TurbineRole) role).getPermissions();
permissionSet.add(ps);
if (permissionSets.containsKey(group))
{
permissionSets.get(group).add(ps);
}
else
{
permissionSets.put(group, ps);
}
}
}
// this check might be not needed any more, required for custom group
if (modelManager != null)
{
this.globalGroup = modelManager.getGlobalGroup();
}
}