Commit 589e4237 authored by michael.simon's avatar michael.simon
Browse files

add function to override policy agreement for sync&share guests

parent 96cb4b89
......@@ -29,11 +29,13 @@ import org.slf4j.Logger;
import edu.kit.lsdf.sns.service.PFAccount;
import edu.kit.lsdf.sns.service.PFAccountService;
import edu.kit.scc.webreg.entity.AgreementTextEntity;
import edu.kit.scc.webreg.entity.PolicyEntity;
import edu.kit.scc.webreg.entity.SamlIdpMetadataEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.exc.RegisterException;
import edu.kit.scc.webreg.service.AgreementTextService;
import edu.kit.scc.webreg.service.SamlIdpMetadataService;
import edu.kit.scc.webreg.service.ServiceService;
import edu.kit.scc.webreg.service.UserService;
......@@ -67,6 +69,9 @@ public class SyncAndShareGuestBean implements Serializable {
@Inject
private UserService userService;
@Inject
private AgreementTextService agreementTextService;
private ServiceEntity serviceEntity;
private PFAccount pfAccount;
......@@ -77,6 +82,8 @@ public class SyncAndShareGuestBean implements Serializable {
private String passwordRegex, passwordRegexMessage;
private String entitlement;
private AgreementTextEntity agreementText;
private Boolean touAccepted = false;
private Boolean initialized = false;
......@@ -104,6 +111,12 @@ public class SyncAndShareGuestBean implements Serializable {
serviceEntity = serviceService.findByIdWithServiceProps(serviceEntity.getId());
if (serviceEntity.getServiceProps().containsKey("guest_agreement")) {
String ga = serviceEntity.getServiceProps().get("guest_agreement");
Long l = Long.parseLong(ga);
agreementText = agreementTextService.findById(l);
}
if (serviceEntity.getServiceProps().containsKey("password_regex"))
passwordRegex = serviceEntity.getServiceProps().get("password_regex");
if (serviceEntity.getServiceProps().containsKey("password_regex_message"))
......@@ -263,4 +276,12 @@ public class SyncAndShareGuestBean implements Serializable {
return policyList;
}
public AgreementTextEntity getAgreementText() {
return agreementText;
}
public void setAgreementText(AgreementTextEntity agreementText) {
this.agreementText = agreementText;
}
}
......@@ -33,11 +33,18 @@
<p:panel id="touPanel">
<div style="margin: 16px 0;">
<ui:repeat var="policy" value="#{syncAndShareGuestBean.policyList}">
<bw:contentBox header="#{policy.name} - #{policy.actualAgreement.name}">
<h:outputText value="#{bbCodeConverter.convert(policy.actualAgreement.agreement)}" escape="false"/>
<h:panelGroup rendered="#{syncAndShareGuestBean.agreementText == null}">
<ui:repeat var="policy" value="#{syncAndShareGuestBean.policyList}">
<bw:contentBox header="#{policy.name} - #{policy.actualAgreement.name}">
<h:outputText value="#{bbCodeConverter.convert(policy.actualAgreement.agreement)}" escape="false"/>
</bw:contentBox>
</ui:repeat>
</h:panelGroup>
<h:panelGroup rendered="#{syncAndShareGuestBean.agreementText != null}">
<bw:contentBox header="#{syncAndShareGuestBean.agreementText.name}">
<h:outputText value="#{bbCodeConverter.convert(syncAndShareGuestBean.agreementText.agreement)}" escape="false"/>
</bw:contentBox>
</ui:repeat>
</h:panelGroup>
</div>
<div class="panel" style="margin-top: 12px;">
......
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