5 [% PROCESS 'i18n.inc' %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9 [% IF op == 'add_form' %]
10 [% t("New identity provider domain") | html %] ›
11 [% ELSIF op == 'edit_form' %]
12 [% tx("Modify identity provider domain '{domain}'", {domain = identity_provider_domain.domain}) | html %] ›
14 [% tx("Identity provider domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %] ›
15 [% t("Identity providers") | html %] ›
16 [% t("Administration") | html %] ›
17 [% t("Koha") | html %]
19 [% INCLUDE 'doc-head-close.inc' %]
22 <body id="admin_identity_provider_domains" class="admin">
23 [% INCLUDE 'header.inc' %]
24 [% INCLUDE 'prefs-admin-search.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 [% WRAPPER breadcrumbs %]
28 [% WRAPPER breadcrumb_item %]
29 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
32 [% WRAPPER breadcrumb_item %]
33 <a href="/cgi-bin/koha/admin/identity_providers.pl">Identity providers</a>
36 [% IF op == 'add_form' %]
37 [% WRAPPER breadcrumb_item %]
38 <a href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | uri -%]">[% tx("Domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</a>
40 [% WRAPPER breadcrumb_item bc_active= 1 %]
41 <span>New identity provider domain</span>
44 [% ELSIF op == 'edit_form' %]
45 [% WRAPPER breadcrumb_item %]
46 <a href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | uri -%]">[% tx("Domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</a>
48 [% WRAPPER breadcrumb_item bc_active= 1 %]
49 [% tx("Modify identity provider domain '{domain}'", {domain = identity_provider_domain.domain}) | html %]
53 [% WRAPPER breadcrumb_item bc_active= 1 %]
54 <span>[% tx("Domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</span>
57 [% END #/ WRAPPER breadcrumbs %]
58 [% END #/ WRAPPER sub-header.inc %]
60 <div class="main container-fluid">
62 <div class="col-sm-10 col-sm-push-2">
65 [% FOREACH m IN messages %]
66 <div class="dialog [% m.type | html %]" id="identity_provider_domain_action_result_dialog">
68 [% CASE 'error_on_update' %]
69 <span>An error occurred trying to open the identity provider domain for editing. The passed ID is invalid.</span>
70 [% CASE 'error_on_insert' %]
71 <span>An error occurred when adding a new identity provider domain. Check the logs for details.</span>
72 [% CASE 'success_on_update' %]
73 <span>Identity provider domain updated successfully.</span>
74 [% CASE 'success_on_insert' %]
75 <span>Identity provider domain added successfully.</span>
77 <span>[% m.code | html %]</span>
82 <div class="dialog message" id="identity_provider_domain_delete_success" style="display: none;"></div>
83 <div class="dialog alert" id="identity_provider_domain_delete_error" style="display: none;"></div>
85 [% IF op == 'add_form' %]
86 <h1>[% tx("New identity provider domain for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</h1>
88 <form action="/cgi-bin/koha/admin/identity_providers.pl" id="add" name="add" class="validated" method="post">
89 <input type="hidden" name="op" value="add" />
90 <input type="hidden" name="domain_ops" value="1" />
91 <input type="hidden" name="identity_provider_id" value="[%- identity_provider_id | html -%]" />
92 <fieldset class="rows">
95 <label for="domain">Domain: </label>
96 <input type="text" name="domain" id="domain" size="60" />
97 <div class="hint">Email domain to match this rule. <button class="more btn btn-ligth" data-target="domain"><i class="fa fa-caret-down"></i> More</button></div>
98 <div class="hint more-domain" style="display: none">
99 <p>If this field is empty, or '*' any email domain will match this rule.</p>
100 <p>You may enter a wildcard at the beginning of the domain. For example, the domain '*library.com' will match 'students.library.com' but will also match 'otherlibrary.com'</p>
101 <p>Exact matches have precedence over wildcard ones, so 'library.com' domain will take precedence over '*library.com' when the email is 'somebody@library.com'</p>
102 <p>The same way, the longest match will take precedence over the shorter one, so '*teacher.university.com' will take precedence over '*.university.com' if the email is 'user@math.teacher.university.com'</p>
106 <label for="update_on_auth">Update on login: </label>
107 <select name="update_on_auth" id="update_on_auth">
108 <option value="1">Update</option>
109 <option value="0" selected="selected">Don't update</option>
111 <span>user data on login</span>
114 <label for="auto_register">Auto register: </label>
115 <select name="auto_register" id="auto_register">
116 <option value="1">Allow</option>
117 <option value="0" selected="selected">Don't allow</option>
119 <span>users to auto register on login</span>
122 <label for="default_library_id">Default library: </label>
123 <select id="default_library_id" name="default_library_id">
124 <option value="">None</option>
125 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %]
127 <div class="hint">Use this library for the patron on auto register</div>
130 <label for="default_category_id">Default category: </label>
131 [% SET categories = Categories.all() %]
132 <select name="default_category_id" id="default_category_id">
133 <option value="">None</option>
134 [% FOREACH category IN categories %]
135 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
138 <div class="hint">Use this category for the patron on auto register</div>
141 <label for="allow_opac">Allow OPAC: </label>
142 <select name="allow_opac" id="allow_opac">
143 <option value="1" selected="selected">Allow</option>
144 <option value="0">Don't allow</option>
146 <span>OPAC users from this domain to login with this identity provider.</span>
149 <label for="allow_staff">Allow staff: </label>
150 <select name="allow_staff" id="allow_staff">
151 <option value="1">Allow</option>
152 <option value="0" selected="selected">Don't allow</option>
154 <span>of this domain to login with this identity provider</span>
158 <fieldset class="action">
159 <input type="submit" value="Submit" />
160 <a class="cancel" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | html -%]">Cancel</a>
166 [% IF op == 'edit_form' %]
167 <h1>[% tx("Modify identity provider domain '{domain}'", {domain = identity_provider_domain.domain}) | html %]</h1>
169 <form action="/cgi-bin/koha/admin/identity_providers.pl" id="edit_save" name="edit_save" class="validated" method="post">
170 <input type="hidden" name="op" value="edit_save" />
171 <input type="hidden" name="domain_ops" value="1" />
172 <input type="hidden" name="identity_provider_id" value="[%- identity_provider_id | html -%]" />
173 <input type="hidden" name="identity_provider_domain_id" value="[%- identity_provider_domain.identity_provider_domain_id | html -%]" />
174 <fieldset class="rows">
177 <label for="domain">Domain: </label>
178 <input type="text" name="domain" id="domain" size="60" value="[%- identity_provider_domain.domain | html -%]"/>
179 <div class="hint">Email domain to match this rule. <button class="more btn btn-ligth" data-target="domain"><i class="fa fa-caret-down"></i> More</button></div>
180 <div class="hint more-domain" style="display: none">
181 <p>If this field is empty, or '*' any email domain will match this rule.</p>
182 <p>You may enter a wildcard at the beginning of the domain. For example, the domain '*library.com' will match 'students.library.com' but will also match 'otherlibrary.com'</p>
183 <p>Exact matches have precedence over asterix ones, so 'library.com' will take precedence over '*library.com' when the email is 'somebody@library.com'</p>
184 <p>The same way, the longest match will take precedence over the shorter one, so '*teacher.university.com' will take precedence over '*.university.com' if the email is 'user@math.teacher.university.com'</p>
188 <label for="update_on_auth">Update on login: </label>
189 <select name="update_on_auth" id="update_on_auth">
190 [% IF identity_provider_domain.update_on_auth == "1" %]
191 <option value="1" selected="selected">Update</option>
192 <option value="0">Don't update</option>
194 <option value="1">Update</option>
195 <option value="0" selected="selected">Don't update</option>
198 <span>user data on login</span>
201 <label for="auto_register">Auto register: </label>
202 <select name="auto_register" id="auto_register">
203 [% IF identity_provider_domain.auto_register == "1" %]
204 <option value="1" selected="selected">Allow</option>
205 <option value="0">Don't allow</option>
207 <option value="1">Allow</option>
208 <option value="0" selected="selected">Don't allow</option>
211 <span>users to auto register on login</span>
214 <label for="default_library_id">Default library: </label>
215 <select id="default_library_id" name="default_library_id">
216 <option value="">None</option>
217 [% PROCESS options_for_libraries libraries => Branches.all( selected => identity_provider_domain.default_library_id, unfiltered => 1, do_not_select_my_library => 1 ) %]
219 <div class="hint">Use this library for the patron on auto register</div>
222 <label for="default_category_id">Default category: </label>
223 [% SET categories = Categories.all() %]
224 <select name="default_category_id" id="default_category_id">
225 <option value="">None</option>
226 [% FOREACH category IN categories %]
227 [% IF category.categorycode == identity_provider_domain.default_category_id %]
228 <option value="[% category.categorycode | html %]" selected="selected">[% category.description | html %]</option>
230 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
234 <div class="hint">Use this category for the patron on auto register</div>
237 <label for="allow_opac">Allow OPAC: </label>
238 <select name="allow_opac" id="allow_opac">
239 [% IF identity_provider_domain.allow_opac == "1" %]
240 <option value="1" selected="selected">Allow</option>
241 <option value="0">Don't allow</option>
243 <option value="1">Allow</option>
244 <option value="0" selected="selected">Don't allow</option>
247 <span>OPAC users of this domain to login with this identity provider</span>
250 <label for="allow_staff">Allow staff: </label>
251 <select name="allow_staff" id="allow_staff">
252 [% IF identity_provider_domain.allow_staff == "1" %]
253 <option value="1" selected="selected">Allow</option>
254 <option value="0">Don't allow</option>
256 <option value="1">Allow</option>
257 <option value="0" selected="selected">Don't allow</option>
260 <span>staff users of this domain to login with this identity provider</span>
264 <fieldset class="action">
265 <input type="submit" value="Submit" />
266 <a class="cancel" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | html -%]">Cancel</a>
272 [% IF op == 'list' %]
274 <div id="toolbar" class="btn-toolbar">
275 <a class="btn btn-default" id="new_identity_provider_domain" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | html -%]&op=add_form"><i class="fa fa-plus"></i> New identity provider domain</a>
278 <h1>[% tx("Identity provider domains for '{identity_provider_code}'", {identity_provider_code = identity_provider_code}) | html %]</h1>
279 <div class="page-section">
280 <table id="identity_provider_domains">
284 <th>Update on login</th>
285 <th>Auto register</th>
286 <th>Default library</th>
287 <th>Default category</th>
290 <th data-class-name="actions noExport">Actions</th>
297 <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
298 <div class="modal-dialog">
299 <div class="modal-content">
300 <div class="modal-header">
301 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
302 <h3 id="delete_confirm_modal_label">Confirm deletion of identity provider domain</h3>
304 <div class="modal-body">
305 <div id="delete_confirm_dialog"></div>
307 <div class="modal-footer">
308 <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
309 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
311 </div> <!-- /.modal-content -->
312 </div> <!-- /.modal-dialog -->
313 </div> <!-- #delete_confirm_modal -->
316 </div> <!-- /.col-sm-10.col-sm-push-2 -->
318 <div class="col-sm-2 col-sm-pull-10">
320 [% INCLUDE 'admin-menu.inc' %]
322 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
323 </div> <!-- /.row -->
326 [% MACRO jsinclude BLOCK %]
327 [% Asset.js("js/admin-menu.js") | $raw %]
328 [% INCLUDE 'datatables.inc' %]
330 $(document).ready(function() {
332 var identity_provider_domains_url = '/api/v1/auth/identity_providers/[%- identity_provider_id | html -%]/domains';
333 [% SET categories = Categories.all() %]
335 [% FOREACH category IN categories %]
336 "[% category.categorycode | html %]": "[% category.description | html %]",
339 [% SET libraries = Branches.all() %]
341 [% FOREACH library IN libraries %]
342 "[% library.branchcode | html %]": "[% library.branchname | html %]",
345 window.identity_provider_domains = $("#identity_provider_domains").kohaTable({
347 "url": identity_provider_domains_url
350 'emptyTable': '<div class="dialog message">'+_("There are no identity provider domains defined.")+'</div>'
354 "render": function (data, type, row, meta) {
355 if ( type == 'display' ) {
356 if ( data != null ) {
357 return data.escapeHtml();
371 "render": function(data, type, row, meta) {
372 if ( data != null ) {
373 return data.escapeHtml();
381 "data": function( row, type, val, meta ) {
382 if (row.update_on_auth) {
392 "data": function( row, type, val, meta ) {
393 if (row.auto_register) {
403 "data": function( row, type, val, meta ) {
404 return libraries[row.default_library_id] || "";
410 "data": function( row, type, val, meta ) {
411 return categories[row.default_category_id] || "";
417 "data": function( row, type, val, meta ) {
418 if (row.allow_opac) {
428 "data": function( row, type, val, meta ) {
429 if (row.allow_staff) {
439 "data": function( row, type, val, meta ) {
440 var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | html -%]&op=edit_form&identity_provider_domain_id='+ encodeURIComponent(row.identity_provider_domain_id) +'"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
441 result += '<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-toggle="modal" data-target="#delete_confirm_modal" data-auth-provider-domain-id="'+ encodeURIComponent(row.identity_provider_domain_id) +'" data-auth-provider-domain="'+ encodeURIComponent((row.domain || '').escapeHtml()) +'"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</a>';
448 createdRow: function (row, data, dataIndex) {
450 $(row).addClass('debug');
455 $('#identity_provider_domains').on( "click", '.delete_identity_provider_domain', function () {
456 var identity_provider_domain_id = $(this).data('auth-provider-domain-id');
457 var identity_provider_domain = decodeURIComponent($(this).data('auth-provider-domain'));
459 $("#delete_confirm_dialog").html(
460 _("You are about to delete the '%s' identity provider domain.").format(identity_provider_domain)
462 $("#delete_confirm_modal_button").data('auth-provider-domain-id', identity_provider_domain_id);
463 $("#delete_confirm_modal_button").data('auth-provider-domain', identity_provider_domain);
466 $("#delete_confirm_modal_button").on( "click", function () {
468 var identity_provider_domain_id = $(this).data('auth-provider-domain-id');
469 var identity_provider_domain = $(this).data('auth-provider-domain');
473 url: identity_provider_domains_url+"/"+identity_provider_domain_id
474 }).success(function() {
475 window.identity_provider_domains.api().ajax.reload(function (data) {
476 $("#smtp_action_result_dialog").hide();
477 $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(identity_provider_domain)).show();
479 }).fail(function () {
480 $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(identity_provider_domain)).show();
481 }).done(function () {
482 $("#delete_confirm_modal").modal('hide');
486 $('button.more').on('click', function(event) {
487 event.preventDefault();
488 var target = $(this).hide().data('target');
489 $('.more-'+target).show();
495 [% INCLUDE 'intranet-bottom.inc' %]