Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b1818546c0 | |||
| bc5a7a7c4c | |||
| 966c9033ef |
@@ -30,9 +30,9 @@ public class RequirementUrlResolver implements EntityUrlResolver {
|
|||||||
Requirement req = (Requirement)entity;
|
Requirement req = (Requirement)entity;
|
||||||
|
|
||||||
if (req.getKind() == Constants.REQ_TYPE_MATERIAL) {
|
if (req.getKind() == Constants.REQ_TYPE_MATERIAL) {
|
||||||
return defaultUrl + Constants.URL_MAP.get(req) + "material/?select=" + String.valueOf(req.getId());
|
return defaultUrl + Constants.URL_MAP.get(req.getClass()) + "material/?select=" + String.valueOf(req.getId());
|
||||||
} else {
|
} else {
|
||||||
return defaultUrl + Constants.URL_MAP.get(req) + "services/?select=" + String.valueOf(req.getId());
|
return defaultUrl + Constants.URL_MAP.get(req.getClass()) + "services/?select=" + String.valueOf(req.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package info.bukova.isspst.services.users;
|
||||||
|
|
||||||
|
import info.bukova.isspst.services.IsspstException;
|
||||||
|
|
||||||
|
public class DeleteUserException extends IsspstException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -5326664758639660224L;
|
||||||
|
|
||||||
|
public DeleteUserException(String message) {
|
||||||
|
super(message);
|
||||||
|
setReason(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import info.bukova.isspst.services.AbstractService;
|
|||||||
import info.bukova.isspst.services.StringXmlMarshaller;
|
import info.bukova.isspst.services.StringXmlMarshaller;
|
||||||
//import info.bukova.isspst.services.LazyLoader;
|
//import info.bukova.isspst.services.LazyLoader;
|
||||||
|
|
||||||
|
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -35,6 +36,8 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
private PasswordEncoder encoder;
|
private PasswordEncoder encoder;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
@Autowired
|
||||||
|
private WorkgroupService workgroupService;
|
||||||
private StringXmlMarshaller<UserSettingsData> marshaller;
|
private StringXmlMarshaller<UserSettingsData> marshaller;
|
||||||
private AuthMethod authMethod;
|
private AuthMethod authMethod;
|
||||||
|
|
||||||
@@ -216,4 +219,15 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
|
|||||||
return authMethod;
|
return authMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(User entity) {
|
||||||
|
workgroupService.loadParents(entity);
|
||||||
|
|
||||||
|
if (entity.getParents().isEmpty()) {
|
||||||
|
super.delete(entity);
|
||||||
|
} else {
|
||||||
|
throw new DeleteUserException("UserIsInWorkgroup");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ public class WorkgroupException extends IsspstException {
|
|||||||
public final static String MSUT_HAS_CENTER = "RoleMustHasCentre";
|
public final static String MSUT_HAS_CENTER = "RoleMustHasCentre";
|
||||||
public final static String MUST_HAS_WORKGROUP = "WorkgroupMustHasCentre";
|
public final static String MUST_HAS_WORKGROUP = "WorkgroupMustHasCentre";
|
||||||
public final static String CYCLIC_MEMBER = "CyclicMembership";
|
public final static String CYCLIC_MEMBER = "CyclicMembership";
|
||||||
|
public final static String HAS_PARENT = "WorkgroupIsInWorkgroup";
|
||||||
|
|
||||||
public WorkgroupException(String message) {
|
public WorkgroupException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
|
setReason(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,6 +248,11 @@ public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implem
|
|||||||
@Transactional
|
@Transactional
|
||||||
@PreAuthorize("hasPermission(this, 'PERM_DELETE')")
|
@PreAuthorize("hasPermission(this, 'PERM_DELETE')")
|
||||||
public void delete(Workgroup entity) {
|
public void delete(Workgroup entity) {
|
||||||
|
Workgroup dbWg = dao.getById(entity.getId());
|
||||||
|
if (!dbWg.getParents().isEmpty()) {
|
||||||
|
throw new WorkgroupException(WorkgroupException.HAS_PARENT);
|
||||||
|
}
|
||||||
|
|
||||||
loadMembers(entity);
|
loadMembers(entity);
|
||||||
for (JobMapping m : entity.getMembers()) {
|
for (JobMapping m : entity.getMembers()) {
|
||||||
loadParents(m.getMember());
|
loadParents(m.getMember());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package info.bukova.isspst.ui;
|
|||||||
import info.bukova.isspst.StringUtils;
|
import info.bukova.isspst.StringUtils;
|
||||||
import info.bukova.isspst.data.DataModel;
|
import info.bukova.isspst.data.DataModel;
|
||||||
import info.bukova.isspst.filters.Filter;
|
import info.bukova.isspst.filters.Filter;
|
||||||
|
import info.bukova.isspst.services.IsspstException;
|
||||||
import info.bukova.isspst.services.Service;
|
import info.bukova.isspst.services.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -202,6 +203,18 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
|||||||
BindUtils.postNotifyChange(null, null,
|
BindUtils.postNotifyChange(null, null,
|
||||||
ListViewModel.this, "dataBean");
|
ListViewModel.this, "dataBean");
|
||||||
BindUtils.postGlobalCommand(null, null, "reloadRelated", null);
|
BindUtils.postGlobalCommand(null, null, "reloadRelated", null);
|
||||||
|
} catch (IsspstException e) {
|
||||||
|
if (e.getReason() != null) {
|
||||||
|
Messagebox.show(
|
||||||
|
StringUtils.localize(e.getReason()),
|
||||||
|
StringUtils.localize("Error"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
StringUtils.localize("DbSaveError"),
|
||||||
|
StringUtils.localize("Error"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
Messagebox.show(StringUtils.localize("DbCannotDelete"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
|
Messagebox.show(StringUtils.localize("DbCannotDelete"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
|
||||||
} catch (AccessDeniedException e) {
|
} catch (AccessDeniedException e) {
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ UsersGridColumnLogin=Login
|
|||||||
UsersGridColumnPersonalID=Osobní číslo
|
UsersGridColumnPersonalID=Osobní číslo
|
||||||
UsersGridColumnFirstName=Jméno
|
UsersGridColumnFirstName=Jméno
|
||||||
UsersGridColumnSureName=Příjmení
|
UsersGridColumnSureName=Příjmení
|
||||||
|
UserIsInWorkgroup=Uživatele nelze smazat, protože je členem některé pracovní skupiny
|
||||||
|
|
||||||
AgendaMaterial=Skupiny materiálu
|
AgendaMaterial=Skupiny materiálu
|
||||||
MaterialFormTitle=Skupina materiálu
|
MaterialFormTitle=Skupina materiálu
|
||||||
@@ -125,7 +126,7 @@ AgendaServices=Skupiny služeb
|
|||||||
ServiceFormTitle=Skupina služeb
|
ServiceFormTitle=Skupina služeb
|
||||||
|
|
||||||
AgendaWorkgroups=Střediska / komise
|
AgendaWorkgroups=Střediska / komise
|
||||||
WorkgroupFormTitle=Pracvní skupina
|
WorkgroupFormTitle=Pracovní skupina
|
||||||
|
|
||||||
AgendaWorkflow=Procesy schválení
|
AgendaWorkflow=Procesy schválení
|
||||||
RequirementType=Typ požadavku:
|
RequirementType=Typ požadavku:
|
||||||
@@ -354,3 +355,4 @@ WorkgroupFormMemberIsCenterMember=Některý ze členů přidávané komise je č
|
|||||||
WorkgroupFormCannotAddUser=Uživatele nelze přidat
|
WorkgroupFormCannotAddUser=Uživatele nelze přidat
|
||||||
WorkgroupFormCannotAddWorkgroup=Komisi nelze přidat
|
WorkgroupFormCannotAddWorkgroup=Komisi nelze přidat
|
||||||
WorkgroupFormOrderLimit=Limit nákupů
|
WorkgroupFormOrderLimit=Limit nákupů
|
||||||
|
WorkgroupIsInWorkgroup=Komisi nelze smazat, protože je členem některého střediska
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
<checkbox
|
<checkbox
|
||||||
label="@load(each.role.description)"
|
label="@load(each.role.description)"
|
||||||
checked="@bind(each.checked)"
|
checked="@bind(each.checked)"
|
||||||
disabled="@load(vm.dataBean.username eq 'admin')" />
|
disabled="@load((vm.dataBean.username eq 'admin') or (each.role.authority eq 'ROLE_USER'))" />
|
||||||
</template>
|
</template>
|
||||||
</vbox>
|
</vbox>
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|||||||
Reference in New Issue
Block a user