if (!obContext.isInAdministratorMode() && clientId.length() > 0) {
if (obj instanceof ClientEnabled) {
if (!obContext.getCurrentClient().getId().equals(clientId)) {
// TODO: maybe move rollback to exception throwing
SessionHandler.getInstance().setDoRollback(true);
throw new OBSecurityException("Client (" + clientId + ") of object (" + obj
+ ") is not present in ClientList " + obContext.getCurrentClient().getId());
}
}
// todo can be improved by only checking if the client or
// organization
// actually changed...
obContext.getEntityAccessChecker().checkWritable(entity);
if (obj instanceof OrganizationEnabled && orgId != null && orgId.length() > 0) {
// todo as only the id is required this can be made much more
// efficient
// by
// not loading the hibernate proxy
if (!obContext.getWritableOrganizations().contains(orgId)) {
// TODO: maybe move rollback to exception throwing
SessionHandler.getInstance().setDoRollback(true);
throw new OBSecurityException("Organization " + orgId + " of object (" + obj
+ ") is not present in OrganizationList " + obContext.getWritableOrganizations());
}
}
}