Skip to content
Snippets Groups Projects
Commit 898a658a authored by Michael Simon's avatar Michael Simon
Browse files

add deregister button for service admins

parent fd3332da
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import edu.kit.scc.webreg.exc.RegisterException;
import edu.kit.scc.webreg.sec.AuthorizationBean;
import edu.kit.scc.webreg.service.RegistryService;
import edu.kit.scc.webreg.service.reg.RegisterUserService;
import edu.kit.scc.webreg.util.SessionManager;
@ManagedBean
@ViewScoped
......@@ -44,6 +45,9 @@ public class ServiceAdminUserDetailBean implements Serializable {
@Inject
private RegisterUserService registerUserService;
@Inject
private SessionManager sessionManager;
private RegistryEntity entity;
private Long id;
......@@ -59,7 +63,7 @@ public class ServiceAdminUserDetailBean implements Serializable {
public void reconsiliation() {
logger.debug("Manual quick recon for Account {} Service {}", entity.getUser().getEppn(), entity.getService().getName());
try {
registerUserService.reconsiliation(entity, false, "service-admin");
registerUserService.reconsiliation(entity, false, "service-admin-" + sessionManager.getUserId());
} catch (RegisterException e) {
logger.error("An error occured", e);
}
......@@ -68,12 +72,21 @@ public class ServiceAdminUserDetailBean implements Serializable {
public void fullReconsiliation() {
logger.debug("Manual full recon for Account {} Service {}", entity.getUser().getEppn(), entity.getService().getName());
try {
registerUserService.reconsiliation(entity, true, "service-admin");
registerUserService.reconsiliation(entity, true, "service-admin-" + sessionManager.getUserId());
} catch (RegisterException e) {
logger.error("An error occured", e);
}
}
public void deregister() {
try {
logger.info("Deregister registry {} via AdminRegistry page", entity.getId());
registerUserService.deregisterUser(entity, "service-admin-" + sessionManager.getUserId());
} catch (RegisterException e) {
logger.warn("Could not deregister User", e);
}
}
public Long getId() {
return id;
}
......
......@@ -94,17 +94,33 @@
</f:facet>
<h:outputText value="#{serviceAdminUserDetailBean.entity.registryValues.get(key)}" />
</p:column>
</p:dataTable>
</p:dataTable>
</p:panel>
</div>
<br/>
<div id="panelInline">
<p:panel header="#{messages.tools}">
<h:panelGroup rendered="#{serviceAdminUserDetailBean.entity.registryStatus == 'ACTIVE'}">
<p:commandButton action="#{serviceAdminUserDetailBean.reconsiliation()}"
value="#{messages.reconsiliation}" update="@form" />
<p:commandButton action="#{serviceAdminUserDetailBean.fullReconsiliation()}"
value="#{messages.full_reconsiliation}" update="@form" />
</h:panelGroup>
<h:panelGroup rendered="#{(serviceAdminUserDetailBean.entity.registryStatus == 'ACTIVE' || serviceAdminUserDetailBean.entity.registryStatus == 'LOST_ACCESS')}">
<p:commandButton id="delUsr" action="#{serviceAdminUserDetailBean.deregister()}" value="#{messages.deregister}"
style="color: red;" update="@form">
<p:confirm header="#{messages.confirm}" message="#{messages.are_you_sure}" icon="ui-icon-alert" />
</p:commandButton>
</h:panelGroup>
</p:panel>
</div>
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="#{messages.yes}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="#{messages.no}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</h:form>
</ui:define>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment