Commit f5b499c8 authored by michael.simon's avatar michael.simon
Browse files

change beans accordingly

parent dfca21b0
......@@ -52,12 +52,12 @@ public class ApprovalListBean implements Serializable {
public void preRenderView(ComponentSystemEvent ev) {
if (serviceEntity == null) {
if (authBean.isUserServiceApprover(serviceId)) {
serviceEntity = serviceService.findById(serviceId);
}
else
throw new NotAuthorizedException("Nicht autorisiert");
serviceEntity = serviceService.findById(serviceId);
}
if (! authBean.isUserServiceApprover(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
}
public GenericLazyDataModel<RegistryEntity, RegistryService, Long> getList() {
......
......@@ -59,7 +59,7 @@ public class ApproveUserBean implements Serializable {
throw new NotAuthorizedException("Nicht autorisiert");
}
if (! authBean.isUserServiceApprover(entity.getService().getId()))
if (! authBean.isUserServiceApprover(entity.getService()))
throw new NotAuthorizedException("Nicht autorisiert");
}
}
......
......@@ -59,11 +59,11 @@ public class GroupAdminAddLocalGroupBean implements Serializable {
private Long serviceId;
public void preRenderView(ComponentSystemEvent ev) {
if (! authBean.isUserServiceGroupAdmin(serviceId))
throw new NotAuthorizedException("Nicht autorisiert");
if (serviceEntity == null)
serviceEntity = serviceService.findById(serviceId);
if (! authBean.isUserServiceGroupAdmin(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
if (entity == null)
entity = service.createNew();
......
......@@ -98,9 +98,6 @@ public class GroupAdminEditLocalGroupBean implements Serializable {
private Boolean savePossible = false;
public void preRenderView(ComponentSystemEvent ev) {
if (! authBean.isUserServiceGroupAdmin(serviceId))
throw new NotAuthorizedException("Nicht autorisiert");
if (entity == null) {
serviceEntity = serviceService.findById(serviceId);
entity = service.findWithUsersAndChildren(groupId);
......@@ -112,6 +109,9 @@ public class GroupAdminEditLocalGroupBean implements Serializable {
usersInGroup = new ArrayList<UserEntity>(userService.findByGroup(entity));
}
if (! authBean.isUserServiceGroupAdmin(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
if (! authBean.isUserInRoles(entity.getAdminRoles())) {
throw new NotAuthorizedException("Nicht autorisiert");
}
......
......@@ -47,11 +47,11 @@ public class GroupAdminListGroupsBean implements Serializable {
private Long serviceId;
public void preRenderView(ComponentSystemEvent ev) {
if (! authBean.isUserServiceGroupAdmin(serviceId))
throw new NotAuthorizedException("Nicht autorisiert");
if (serviceEntity == null)
serviceEntity = serviceService.findById(serviceId);
if (! authBean.isUserServiceGroupAdmin(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
if (groupFlagList == null)
groupFlagList = groupFlagService.findLocalGroupsForService(serviceEntity);
......
......@@ -92,12 +92,12 @@ public class GroupAdminShowLocalGroupBean implements Serializable {
private Boolean editable = true;
public void preRenderView(ComponentSystemEvent ev) {
if (! authBean.isUserServiceGroupAdmin(serviceId))
throw new NotAuthorizedException("Nicht autorisiert");
if (entity == null)
init();
if (! authBean.isUserServiceGroupAdmin(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
if (! authBean.isUserInRoles(entity.getAdminRoles())) {
messageGenerator.addInfoMessage("Nicht editierbar", "Die Gruppe ist nicht editierbar");
editable = false;
......
......@@ -51,15 +51,15 @@ public class ServiceAdminDetailsBean implements Serializable {
private String descriptionEdit, shortDescriptionEdit;
public void preRenderView(ComponentSystemEvent ev) {
if (! authBean.isUserServiceAdmin(serviceId))
throw new NotAuthorizedException("Nicht autorisiert");
if (serviceEntity == null) {
serviceEntity = serviceService.findWithPolicies(serviceId);
serviceDescBB = bbCodeConverter.convert(serviceEntity.getDescription());
descriptionEdit = serviceEntity.getDescription();
shortDescriptionEdit = serviceEntity.getShortDescription();
}
if (! authBean.isUserServiceAdmin(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
}
public void updateDescription() {
......
......@@ -54,12 +54,12 @@ public class ServiceAdminStatsBean implements Serializable {
private PieChartModel userPerIdpPie;
public void preRenderView(ComponentSystemEvent ev) {
if (! authBean.isUserServiceAdmin(serviceId))
throw new NotAuthorizedException("Nicht autorisiert");
if (serviceEntity == null) {
serviceEntity = serviceService.findById(serviceId);
}
if (! authBean.isUserServiceAdmin(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
}
public List<Object> getUserPerIdpList() {
......
......@@ -55,8 +55,8 @@ public class ServiceAdminUserDetailBean implements Serializable {
public void preRenderView(ComponentSystemEvent ev) {
entity = service.findByIdWithAgreements(id);
if (! (authBean.isUserServiceAdmin(entity.getService().getId()) ||
authBean.isUserServiceHotline(entity.getService().getId())))
if (! (authBean.isUserServiceAdmin(entity.getService()) ||
authBean.isUserServiceHotline(entity.getService())))
throw new NotAuthorizedException("Nicht autorisiert");
}
......
......@@ -56,12 +56,12 @@ public class ServiceAdminUserListBean implements Serializable {
public void preRenderView(ComponentSystemEvent ev) {
if (serviceEntity == null) {
if (authBean.isUserServiceAdmin(serviceId) || authBean.isUserServiceHotline(serviceId)) {
serviceEntity = serviceService.findById(serviceId);
}
else
throw new NotAuthorizedException("Nicht autorisiert");
serviceEntity = serviceService.findById(serviceId);
}
if (! (authBean.isUserServiceAdmin(serviceEntity) ||
authBean.isUserServiceHotline(serviceEntity)))
throw new NotAuthorizedException("Nicht autorisiert");
}
public ServiceEntity getServiceEntity() {
......
......@@ -62,13 +62,12 @@ public class ServiceAdminUserListDeproBean implements Serializable {
public void preRenderView(ComponentSystemEvent ev) {
if (serviceEntity == null) {
if (authBean.isUserServiceAdmin(serviceId)) {
serviceEntity = serviceService.findById(serviceId);
deproList = service.findRegistriesForDepro(serviceEntity.getShortName());
}
else
throw new NotAuthorizedException("Nicht autorisiert");
serviceEntity = serviceService.findById(serviceId);
deproList = service.findRegistriesForDepro(serviceEntity.getShortName());
}
if (! authBean.isUserServiceAdmin(serviceEntity))
throw new NotAuthorizedException("Nicht autorisiert");
}
public void depro(RegistryEntity registry) {
......
......@@ -229,25 +229,25 @@ public class AuthorizationBean implements Serializable {
return false;
}
public boolean isUserServiceAdmin(Long id) {
public boolean isUserServiceAdmin(ServiceEntity id) {
if (id == null)
return false;
return sessionManager.getServiceAdminList().contains(id);
}
public boolean isUserServiceApprover(Long id) {
public boolean isUserServiceApprover(ServiceEntity id) {
if (id == null)
return false;
return sessionManager.getServiceApproverList().contains(id);
}
public boolean isUserServiceHotline(Long id) {
public boolean isUserServiceHotline(ServiceEntity id) {
if (id == null)
return false;
return sessionManager.getServiceHotlineList().contains(id);
}
public boolean isUserServiceGroupAdmin(Long id) {
public boolean isUserServiceGroupAdmin(ServiceEntity id) {
if (id == null)
return false;
return sessionManager.getServiceGroupAdminList().contains(id);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment