Skip to content
Snippets Groups Projects
Commit 88334fe0 authored by pabois's avatar pabois
Browse files

wip extranets sso

parent 76785a58
No related branches found
No related tags found
Loading
......@@ -5,6 +5,13 @@ window.osuny.sso = {
this.hasSsoInput.addEventListener('change', this.onHasSsoChange.bind(this));
this.ssoFields = document.querySelectorAll('.sso-inputs');
this.onHasSsoChange();
this.hasInheritedSsoInput = document.querySelector('input[type="checkbox"][name$="[sso_inherit_from_university]"]');
if (this.hasInheritedSsoInput) {
this.hasInheritedSsoInput.addEventListener('change', this.onHasInheritedSsoChange.bind(this));
this.ssoInheritedFields = document.querySelectorAll('.sso-inherited-inputs');
this.onHasInheritedSsoChange();
}
},
onHasSsoChange: function () {
......@@ -20,6 +27,19 @@ window.osuny.sso = {
}
},
onHasInheritedSsoChange: function () {
'use strict';
var value = this.hasInheritedSsoInput.checked,
i;
for (i = 0; i < this.ssoInheritedFields.length; i += 1) {
if (value) {
this.ssoInheritedFields[i].classList.add('d-none');
} else {
this.ssoInheritedFields[i].classList.remove('d-none');
}
}
},
invoke: function () {
'use strict';
return {
......
......@@ -64,6 +64,9 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat
def extranet_params
params.require(:communication_extranet)
.permit(:name, :domain, :about_type, :about_id, :registration_contact, :logo, :logo_delete)
.permit(:name, :domain, :about_type, :about_id,
:registration_contact, :logo, :logo_delete,
:has_sso, :sso_inherit_from_university, :sso_target_url, :sso_cert, :sso_name_identifier_format, :sso_mapping
)
end
end
......@@ -36,15 +36,19 @@
<%= f.input :has_sso %>
<div class="sso-inputs">
<%= f.input :sso_inherit_from_university if current_university.has_sso? %>
<%= f.input :sso_target_url, required: true %>
<%= f.input :sso_cert, required: true %>
<%= f.input :sso_name_identifier_format, required: true %>
<div class="sso-inherited-inputs">
<%= f.input :sso_target_url, required: true %>
<%= f.input :sso_cert, required: true %>
<%= f.input :sso_name_identifier_format, required: true %>
</div>
</div>
</div>
<div class="col-md-6 sso-inputs">
<h4 class="mb-4"><%= University.human_attribute_name('sso_mapping') %></h4>
<%= f.error_notification message: f.object.errors[:sso_mapping].to_sentence if f.object.errors[:sso_mapping].present? %>
<%= render 'server/universities/sso_mapping', kind: 'extranet', object: extranet %>
<div class="sso-inherited-inputs">
<h4 class="mb-4"><%= University.human_attribute_name('sso_mapping') %></h4>
<%= f.error_notification message: f.object.errors[:sso_mapping].to_sentence if f.object.errors[:sso_mapping].present? %>
<%= render 'server/universities/sso_mapping', kind: 'extranet', object: extranet %>
</div>
</div>
</div>
</div>
......
......@@ -131,6 +131,12 @@ en:
text: Text
title: Title
website: Website
errors:
models:
communication/extranet:
attributes:
sso_mapping:
missing_email: doesn't handle the email
admin:
communication:
blocks:
......
......@@ -132,6 +132,12 @@ fr:
text: Texte
title: Titre
website: Site Web
errors:
models:
communication/extranet:
attributes:
sso_mapping:
missing_email: ne gère pas l'adresse email
admin:
communication:
blocks:
......
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