Do agendy požadavků bylo přidáno nové oprávnění pro mazání neschválených

požadavků.
closes #183
Verze_1.0
Josef Rokos 10 years ago
parent 66133dce1a
commit 6ff69c932c

@ -102,15 +102,18 @@ public class Constants {
public final static String PERM_SHOW_ALL_REQ = "PERM_SHOW_ALL_REQ"; public final static String PERM_SHOW_ALL_REQ = "PERM_SHOW_ALL_REQ";
public final static String PERM_EDIT_NEW = "PERM_EDIT_NEW"; public final static String PERM_EDIT_NEW = "PERM_EDIT_NEW";
public final static String PERM_EDIT_OWN = "PERM_EDIT_OWN"; public final static String PERM_EDIT_OWN = "PERM_EDIT_OWN";
public final static String PERM_DELETE_NEW = "PERM_DELETE_NEW";
public final static Permission SPECIAL_PERMISSIONS[] = { public final static Permission SPECIAL_PERMISSIONS[] = {
new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL), new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL),
new Permission(PERM_DELETE_NEW, "Mazat neschválené", MOD_REQUIREMENTS, PermissionType.GLOBAL),
new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_REQUIREMENTS, PermissionType.WORKGROUP), new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_REQUIREMENTS, PermissionType.WORKGROUP),
new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_REQUIREMENTS, PermissionType.CENTRE), new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_REQUIREMENTS, PermissionType.CENTRE),
new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_REQUIREMENTS, PermissionType.GLOBAL), new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_REQUIREMENTS, PermissionType.GLOBAL),
new Permission(PERM_APPROVE, "Schválení", MOD_REQUIREMENTS, PermissionType.WORKGROUP), new Permission(PERM_APPROVE, "Schválení", MOD_REQUIREMENTS, PermissionType.WORKGROUP),
new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL), new Permission(PERM_EDIT_NEW, "Upravit neschválené", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),
new Permission(PERM_DELETE_NEW, "Mazat neschválené", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),
new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_TRIPREQUIREMENTS, PermissionType.WORKGROUP), new Permission(PERM_SHOW_WORKGROUP_REQ, "Zobrazení požadavků komise", MOD_TRIPREQUIREMENTS, PermissionType.WORKGROUP),
new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_TRIPREQUIREMENTS, PermissionType.CENTRE), new Permission(PERM_SHOW_CENTRE_REQ, "Zobrazení požadavků střediska", MOD_TRIPREQUIREMENTS, PermissionType.CENTRE),
new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL), new Permission(PERM_SHOW_ALL_REQ, "Zobrazení všech požadavků", MOD_TRIPREQUIREMENTS, PermissionType.GLOBAL),

@ -30,6 +30,10 @@ public abstract class AbstractRequirementEvaluator extends AbstractModuleEvaluat
return req.getState() == RequirementState.NEW; return req.getState() == RequirementState.NEW;
} }
if (permission.equals(Constants.PERM_DELETE_NEW)) {
return req.getState() == RequirementState.NEW;
}
return true; return true;
} }

@ -59,6 +59,10 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
return ""; return "";
} }
public String getDeleteEntityPermission() {
return "";
}
@Override @Override
@PreAuthorize("hasPermission(this, 'PERM_ADD')") @PreAuthorize("hasPermission(this, 'PERM_ADD')")
public final T create() { public final T create() {
@ -93,7 +97,7 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
@Override @Override
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_DELETE')") @PreAuthorize("hasPermission(this, 'PERM_DELETE') or hasPermission(#entity, this.getDeleteEntityPermission())")
public void delete(T entity) { public void delete(T entity) {
if (dao == null) { if (dao == null) {
throw new IsspstException("DAO is null"); throw new IsspstException("DAO is null");

@ -383,4 +383,9 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
return Constants.PERM_EDIT_NEW; return Constants.PERM_EDIT_NEW;
} }
@Override
public String getDeleteEntityPermission() {
return Constants.PERM_DELETE_NEW;
}
} }

Loading…
Cancel
Save