6 [% INCLUDE 'doc-head-open.inc' %]
8 [% IF op == 'add_form' %]
9 New identity provider domain › [% ELSIF op == 'edit_form' %]
10 Edit identity provider domain › [% END %]
12 Identity providers › Administration › Koha
14 [% INCLUDE 'doc-head-close.inc' %]
17 <body id="admin_identity_provider_domains" class="admin">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'prefs-admin-search.inc' %]
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
24 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
27 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
31 <a href="/cgi-bin/koha/admin/identity_providers.pl">Identity providers</a>
34 [% IF op == 'add_form' %]
36 <a href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | uri -%]">Domains for [%- identity_provider_code | html -%]</a>
39 <a href="#" aria-current="page">
44 [% ELSIF op == 'edit_form' %]
46 <a href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | uri -%]">Domains for [%- identity_provider_code | html -%]</a>
49 <a href="#" aria-current="page">
56 <a href="#" aria-current="page">
57 Domains for [%- identity_provider_code | html -%]
64 <div class="main container-fluid">
66 <div class="col-sm-10 col-sm-push-2">
69 [% FOREACH m IN messages %]
70 <div class="dialog [% m.type | html %]" id="identity_provider_domain_action_result_dialog">
72 [% CASE 'error_on_update' %]
73 <span>An error occurred trying to open the identity provider domain for editing. The passed id is invalid.</span>
74 [% CASE 'error_on_insert' %]
75 <span>An error occurred when adding a new identity provider domain.</span>
76 [% CASE 'success_on_update' %]
77 <span>Identity provider domain updated successfully.</span>
78 [% CASE 'success_on_insert' %]
79 <span>Identity provider domain added successfully.</span>
81 <span>[% m.code | html %]</span>
86 <div class="dialog message" id="identity_provider_domain_delete_success" style="display: none;"></div>
87 <div class="dialog alert" id="identity_provider_domain_delete_error" style="display: none;"></div>
89 [% IF op == 'add_form' %]
90 <h1>New email domain</h1>
91 <div class="page-section">
92 <form action="/cgi-bin/koha/admin/identity_providers.pl" id="add" name="add" class="validated" method="post">
93 <input type="hidden" name="op" value="add" />
94 <input type="hidden" name="domain_ops" value="1" />
95 <input type="hidden" name="identity_provider_id" value="[%- identity_provider_id | html -%]" />
96 <fieldset class="rows">
99 <label for="domain">Domain: </label>
100 <input type="text" name="domain" id="domain" size="60" />
101 <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>
102 <div class="hint more-domain" style="display: none">
103 <div>If this field is empty, or '*' any email domain will match this rule.</div>
104 <div>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'</div>
105 <div>Exact matches have presedence over wildcard ones, so 'library.com' domain will take presedence over '*library.com' when the email is 'somebody@library.com'</div>
106 <div>The same way, the longest match will take presedence over the shorter one, so '*teacher.university.com' will take presedence over '*.university.com' if the email is 'user@math.teacher.university.com'</div>
112 <fieldset class="rows">
115 <label for="update_on_auth">Update on login: </label>
116 <select name="update_on_auth" id="update_on_auth">
117 <option value="1">Update</option>
118 <option value="0" selected="selected">Don't update</option>
120 <span>user data on login</span>
123 <label for="auto_register">Auto register: </label>
124 <select name="auto_register" id="auto_register">
125 <option value="1">Allow</option>
126 <option value="0" selected="selected">Don't allow</option>
128 <span>users to auto register on login</span>
131 <label for="default_library_id">Default library: </label>
132 <select id="default_library_id" name="default_library_id">
133 <option value="">None</option>
134 [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %]
136 <div class="hint">Use this library for the patron on auto register</div>
139 <label for="default_category_id">Default category: </label>
140 [% SET categories = Categories.all() %]
141 <select name="default_category_id" id="default_category_id">
142 <option value="">None</option>
143 [% FOREACH category IN categories %]
144 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
147 <div class="hint">Use this category for the patron on auto register</div>
150 <label for="allow_opac">Allow opac: </label>
151 <select name="allow_opac" id="allow_opac">
152 <option value="1" selected="selected">Allow</option>
153 <option value="0">Don't allow</option>
155 <span>OPAC users from this domain to login with this identity provider.</span>
158 <label for="allow_opac">Allow staff: </label>
159 <select name="allow_staff" id="allow_staff">
160 <option value="1">Allow</option>
161 <option value="0" selected="selected">Don't allow</option>
163 <span>of this domain to login with this identity provider</span>
167 <fieldset class="action">
168 <input type="submit" value="Submit" />
169 <a class="cancel" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | html -%]">Cancel</a>
175 [% IF op == 'edit_form' %]
176 <h1>Edit identity provider domain</h1>
177 <div class="page-section">
178 <form action="/cgi-bin/koha/admin/identity_providers.pl" id="edit_save" name="edit_save" class="validated" method="post">
179 <input type="hidden" name="op" value="edit_save" />
180 <input type="hidden" name="domain_ops" value="1" />
181 <input type="hidden" name="identity_provider_id" value="[%- identity_provider_id | html -%]" />
182 <input type="hidden" name="identity_provider_domain_id" value="[%- identity_provider_domain.identity_provider_domain_id | html -%]" />
183 <fieldset class="rows">
186 <label for="domain">Domain: </label>
187 <input type="text" name="domain" id="domain" size="60" value="[%- identity_provider_domain.domain | html -%]"/>
188 <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>
189 <div class="hint more-domain" style="display: none">
190 <div>If this field is empty, or '*' any email domain will match this rule.</div>
191 <div>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'</div>
192 <div>Exact matches have presedence over asterix ones, so if the 'library.com' domain will take presedence over '*library.com' when the email is 'somebody@library.com'</div>
193 <div>The same way, the longest match will take presedence over the shorter one, so '*teacher.university.com' will take presedence over '*.university.com' if the email is 'user@math.teacher.university.com'</div>
199 <fieldset class="rows">
202 <label for="update_on_auth">Update on login: </label>
203 <select name="update_on_auth" id="update_on_auth">
204 [% IF identity_provider_domain.update_on_auth == "1" %]
205 <option value="1" selected="selected">Update</option>
206 <option value="0">Don't update</option>
208 <option value="1">Update</option>
209 <option value="0" selected="selected">Don't update</option>
212 <span>user data on login</span>
215 <label for="auto_register">Auto register: </label>
216 <select name="auto_register" id="auto_register">
217 [% IF identity_provider_domain.auto_register == "1" %]
218 <option value="1" selected="selected">Allow</option>
219 <option value="0">Don't allow</option>
221 <option value="1">Allow</option>
222 <option value="0" selected="selected">Don't allow</option>
225 <span>users to auto register on login</span>
228 <label for="default_library_id">Default library: </label>
229 <select id="default_library_id" name="default_library_id">
230 <option value="">None</option>
231 [% PROCESS options_for_libraries libraries => Branches.all( selected => identity_provider_domain.default_library_id, unfiltered => 1, do_not_select_my_library => 1 ) %]
233 <div class="hint">Use this library for the patron on auto register</div>
236 <label for="default_category_id">Default category: </label>
237 [% SET categories = Categories.all() %]
238 <select name="default_category_id" id="default_category_id">
239 <option value="">None</option>
240 [% FOREACH category IN categories %]
241 [% IF category.categorycode == identity_provider_domain.default_category_id %]
242 <option value="[% category.categorycode | html %]" selected="selected">[% category.description | html %]</option>
244 <option value="[% category.categorycode | html %]">[% category.description | html %]</option>
248 <div class="hint">Use this category for the patron on auto register</div>
251 <label for="allow_opac">Allow opac: </label>
252 <select name="allow_opac" id="allow_opac">
253 [% IF identity_provider_domain.allow_opac == "1" %]
254 <option value="1" selected="selected">Allow</option>
255 <option value="0">Don't allow</option>
257 <option value="1">Allow</option>
258 <option value="0" selected="selected">Don't allow</option>
261 <span>opac users of this domain to login with this identity provider</span>
264 <label for="allow_opac">Allow staff: </label>
265 <select name="allow_staff" id="allow_staff">
266 [% IF identity_provider_domain.allow_staff == "1" %]
267 <option value="1" selected="selected">Allow</option>
268 <option value="0">Don't allow</option>
270 <option value="1">Allow</option>
271 <option value="0" selected="selected">Don't allow</option>
274 <span>staff users of this domain to login with this identity provider</span>
278 <fieldset class="action">
279 <input type="submit" value="Submit" />
280 <a class="cancel" href="/cgi-bin/koha/admin/identity_providers.pl?domain_ops=1&identity_provider_id=[%- identity_provider_id | html -%]">Cancel</a>
286 [% IF op == 'list' %]
288 <div id="toolbar" class="btn-toolbar">
289 <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 email domain</a>
292 <h1>Identity provider email domains</h1>
293 <div class="page-section">
294 <table id="identity_provider_domains">
298 <th>Update on login</th>
299 <th>Auto register</th>
300 <th>Default library</th>
301 <th>Default category</th>
304 <th data-class-name="actions noExport">Actions</th>
311 <div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
312 <div class="modal-dialog">
313 <div class="modal-content">
314 <div class="modal-header">
315 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
316 <h3 id="delete_confirm_modal_label">Delete identity provider domain</h3>
318 <div class="modal-body">
319 <div id="delete_confirm_dialog"></div>
321 <div class="modal-footer">
322 <a href="#" class="btn btn-default" id="delete_confirm_modal_button" role="button" data-toggle="modal">Delete</a>
323 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
325 </div> <!-- /.modal-content -->
326 </div> <!-- /.modal-dialog -->
327 </div> <!-- #delete_confirm_modal -->
330 </div> <!-- /.col-sm-10.col-sm-push-2 -->
332 <div class="col-sm-2 col-sm-pull-10">
334 [% INCLUDE 'admin-menu.inc' %]
336 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
337 </div> <!-- /.row -->
340 [% MACRO jsinclude BLOCK %]
341 [% Asset.js("js/admin-menu.js") | $raw %]
342 [% INCLUDE 'datatables.inc' %]
344 $(document).ready(function() {
346 var identity_provider_domains_url = '/api/v1/auth/identity_providers/[%- identity_provider_id | html -%]/domains';
347 [% SET categories = Categories.all() %]
349 [% FOREACH category IN categories %]
350 "[% category.categorycode | html %]": "[% category.description | html %]",
353 [% SET libraries = Branches.all() %]
355 [% FOREACH library IN libraries %]
356 "[% library.branchcode | html %]": "[% library.branchname | html %]",
359 window.identity_provider_domains = $("#identity_provider_domains").kohaTable({
361 "url": identity_provider_domains_url
364 'emptyTable': '<div class="dialog message">'+_("There are no identity provider domains defined.")+'</div>'
368 "render": function (data, type, row, meta) {
369 if ( type == 'display' ) {
370 if ( data != null ) {
371 return data.escapeHtml();
385 "render": function(data, type, row, meta) {
386 if ( data != null ) {
387 return data.escapeHtml();
395 "data": function( row, type, val, meta ) {
396 if (row.update_on_auth) {
406 "data": function( row, type, val, meta ) {
407 if (row.auto_register) {
417 "data": function( row, type, val, meta ) {
418 return libraries[row.default_library_id] || "";
424 "data": function( row, type, val, meta ) {
425 return categories[row.default_category_id] || "";
431 "data": function( row, type, val, meta ) {
432 if (row.allow_opac) {
442 "data": function( row, type, val, meta ) {
443 if (row.allow_staff) {
453 "data": function( row, type, val, meta ) {
454 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 fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>'+"\n";
455 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" aria-hidden="true"></i> '+_("Delete")+'</a>';
462 createdRow: function (row, data, dataIndex) {
464 $(row).addClass('debug');
469 $('#identity_provider_domains').on( "click", '.delete_identity_provider_domain', function () {
470 var identity_provider_domain_id = $(this).data('auth-provider-domain-id');
471 var identity_provider_domain = decodeURIComponent($(this).data('auth-provider-domain'));
473 $("#delete_confirm_dialog").html(
474 _("You are about to delete the '%s' identity provider domain.").format(identity_provider_domain)
476 $("#delete_confirm_modal_button").data('auth-provider-domain-id', identity_provider_domain_id);
477 $("#delete_confirm_modal_button").data('auth-provider-domain', identity_provider_domain);
480 $("#delete_confirm_modal_button").on( "click", function () {
482 var identity_provider_domain_id = $(this).data('auth-provider-domain-id');
483 var identity_provider_domain = $(this).data('auth-provider-domain');
487 url: identity_provider_domains_url+"/"+identity_provider_domain_id
488 }).success(function() {
489 window.identity_provider_domains.api().ajax.reload(function (data) {
490 $("#smtp_action_result_dialog").hide();
491 $("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(identity_provider_domain)).show();
493 }).fail(function () {
494 $("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs.").format(identity_provider_domain)).show();
495 }).done(function () {
496 $("#delete_confirm_modal").modal('hide');
500 $('button.more').on('click', function(event) {
501 event.preventDefault();
502 var target = $(this).hide().data('target');
503 $('.more-'+target).show();
509 [% INCLUDE 'intranet-bottom.inc' %]