use of org.pentaho.platform.api.engine.IAclHolder in project pentaho-platform by pentaho.
the class SpringSecurityPermissionMgr method getEffectivePermissions.
public Map<IPermissionRecipient, IPermissionMask> getEffectivePermissions(Object domainInstance) {
IAclHolder aclHolder = (IAclHolder) domainInstance;
List<IPentahoAclEntry> aclList = aclHolder.getEffectiveAccessControls();
return transformEntries(aclList);
}
use of org.pentaho.platform.api.engine.IAclHolder in project pentaho-platform by pentaho.
the class SpringSecurityPermissionMgr method setPermission.
@SuppressWarnings("deprecation")
public void setPermission(final IPermissionRecipient permissionRecipient, final IPermissionMask permission, final Object object) {
if (object == null || !(object instanceof IAclHolder)) {
// i would argue that the "object" parameter should be IAclHolder!
return;
}
IAclHolder aclHolder = (IAclHolder) object;
PentahoAclEntry entry = new PentahoAclEntry();
// TODO mlowery instanceof is undesirable as it doesn't allow new concrete classes.
if (permissionRecipient instanceof SimpleRole) {
entry.setRecipient(new SimpleGrantedAuthority(permissionRecipient.getName()));
} else {
entry.setRecipient(permissionRecipient.getName());
}
entry.addPermission(permission.getMask());
// HibernateUtil.beginTransaction(); - This is now handled by the RepositoryFile
aclHolder.getAccessControls().add(entry);
// HibernateUtil.commitTransaction(); - This should be covered by the exitPoint call
}
use of org.pentaho.platform.api.engine.IAclHolder in project pentaho-platform by pentaho.
the class SpringSecurityPermissionMgr method setPermissions.
@SuppressWarnings("deprecation")
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 SimpleGrantedAuthority(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
}
use of org.pentaho.platform.api.engine.IAclHolder in project pentaho-platform by pentaho.
the class SpringSecurityPermissionMgr method getPermissions.
public Map<IPermissionRecipient, IPermissionMask> getPermissions(final Object domainInstance) {
IAclHolder aclHolder = (IAclHolder) domainInstance;
List<IPentahoAclEntry> aclList = aclHolder.getAccessControls();
return transformEntries(aclList);
}
Aggregations