Privileges added: super stupid implememtation allow everyone to to

everything and that cannot be altered.
This commit is contained in:
Purodha Blissenbach 2012-08-16 12:48:07 +02:00
parent cf132cf569
commit ee5fbad254
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package de.hsadmin.core.model;
import de.hsadmin.mods.user.UnixUser;
public interface PrivilegesInterface {
public boolean isAllowedToCreate( UnixUser user, AbstractEntity entity ) ;
public boolean isAllowedToSearch( UnixUser user, AbstractEntity entity ) ;
public boolean isAllowedToUpdate( UnixUser user, AbstractEntity orignalentity, AbstractEntity targetentity ) ;
public boolean isAllowedToDelete( UnixUser user, AbstractEntity entity ) ;
}

View File

@ -0,0 +1,57 @@
package de.hsadmin.core.model;
import java.util.List;
import de.hsadmin.mods.user.UnixUser;
public class PrivilegesModuleImpl extends AbstractModuleImpl implements PrivilegesInterface {
@Override
public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException {
return super.add(newEntity);
}
@Override
public List<AbstractEntity> search(
Class<? extends AbstractEntity> entityClass, String condition,
String orderBy) throws HSAdminException {
return super.search(entityClass, condition, orderBy);
}
@Override
public AbstractEntity update(AbstractEntity existingEntity)
throws HSAdminException {
return super.update(existingEntity);
}
@Override
public void delete(AbstractEntity existingEntity) throws HSAdminException {
super.delete(existingEntity);
}
@Override
public boolean isAllowedToCreate(UnixUser user, AbstractEntity entity) {
// stupid generic implementation allowing everything.
return true;
}
@Override
public boolean isAllowedToSearch(UnixUser user, AbstractEntity entity) {
// stupid generic implementation allowing everything.
return true;
}
@Override
public boolean isAllowedToUpdate(UnixUser user,
AbstractEntity orignalentity, AbstractEntity targetentity) {
// stupid generic implementation allowing everything.
return true;
}
@Override
public boolean isAllowedToDelete(UnixUser user, AbstractEntity entity) {
// stupid generic implementation allowing everything.
return true;
}
}