public void setPermissions( final Map<IPermissionRecipient, IPermissionMask> permissionsMap, final Object object ) {
if ( object == null || !( object instanceof IAclHolder ) ) {
// i would argue that the "object" parameter should be IAclHolder!
return;
}
IAclHolder aclHolder = (IAclHolder) object;
Set<Map.Entry<IPermissionRecipient, IPermissionMask>> mapEntrySet = permissionsMap.entrySet();
ArrayList<IPentahoAclEntry> aclList = new ArrayList<IPentahoAclEntry>();
for ( Entry<IPermissionRecipient, IPermissionMask> mapEntry : mapEntrySet ) {
PentahoAclEntry pentahoAclEntry = new PentahoAclEntry();
IPermissionRecipient permissionRecipient = mapEntry.getKey();
if ( permissionRecipient instanceof SimpleRole ) {
pentahoAclEntry.setRecipient( new GrantedAuthorityImpl( permissionRecipient.getName() ) );
} else {
pentahoAclEntry.setRecipient( permissionRecipient.getName() );
}
pentahoAclEntry.addPermission( mapEntry.getValue().getMask() );
aclList.add( pentahoAclEntry );
}
// HibernateUtil.beginTransaction(); - This is now handled in the RepositoryFile
aclHolder.resetAccessControls( aclList );
// HibernateUtil.commitTransaction(); - This is covered by the exitPoint
}