Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/user_saml.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-07-05 22:53:52 +0300
committerBjoern Schiessle <bjoern@schiessle.org>2018-08-03 13:42:08 +0300
commit8c3a4b83e4ec7153222e7307aa12323a2d2b0eed (patch)
treea0d372ce137b28fcdb00ddd30bb902ce587d46fc /js/admin.js
parentd908675b74b5ea5d19285d1ebd04370ca3f8079f (diff)
Add global settings that are valid for all identity providers
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'js/admin.js')
-rw-r--r--js/admin.js48
1 files changed, 38 insertions, 10 deletions
diff --git a/js/admin.js b/js/admin.js
index bfc19d84..76c59801 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -70,9 +70,13 @@
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.setSamlConfigValue, this, category, setting, value));
return;
}
-
+ // store global config flags without idp prefix
+ var configIdentifier = this.getConfigIdentifier();
+ if (typeof global === 'undefined') {
+ configIdentifier = '';
+ }
OC.msg.startSaving('#user-saml-save-indicator');
- OCP.AppConfig.setValue('user_saml', this.getConfigIdentifier() + category + '-' + setting, value);
+ OCP.AppConfig.setValue('user_saml', configIdentifier + category + '-' + setting, value);
OC.msg.finishedSaving('#user-saml-save-indicator', {status: 'success', data: {message: t('user_saml', 'Saved')}});
}
}
@@ -82,20 +86,28 @@ $(function() {
OCA.User_SAML.Admin.init();
// Hide depending on the setup state
var type = $('#user-saml').data('type');
- if(type !== '') {
- $('#user-saml-choose-type').addClass('hidden');
- $('#user-saml-warning-admin-user').removeClass('hidden');
+ console.log(type);
+ if(type === '') {
+ $('#user-saml-choose-type').removeClass('hidden');
} else {
- $('#user-saml div:gt(2)').addClass('hidden');
- $('#user-saml-settings .button').addClass('hidden');
+ $('#user-saml-global').removeClass('hidden');
+ $('#user-saml-warning-admin-user').removeClass('hidden');
+ $('#user-saml-settings').removeClass('hidden');
+ $('#user-saml-general').removeClass('hidden');
}
if(type === 'environment-variable') {
- $('#user-saml div:gt(4)').addClass('hidden');
+ // we need the settings div to be visible for require_providioned_account
+ $('#user-saml-settings div').addClass('hidden');
$('#user-saml-settings .button').addClass('hidden');
}
+ if (type === 'saml') {
+ $('#user-saml .account-list').removeClass('hidden');
+ }
if($('#user-saml-general-require_provisioned_account').val() === '0' && type !== '') {
- $('#user-saml-attribute-mapping').toggleClass('hidden');
+ $('#user-saml-attribute-mapping').removeClass('hidden');
+ } else {
+ $('#user-saml-attribute-mapping').addClass('hidden');
}
$('#user-saml-choose-saml').click(function(e) {
@@ -157,6 +169,9 @@ $(function() {
});
});
+ $('[data-js="remove-idp"]').on('click', function() {
+ OCA.User_SAML.Admin.removeProvider();
+ });
// Enable tabs
$('input:checkbox[value="1"]').attr('checked', true);
@@ -204,7 +219,7 @@ $(function() {
}
});
- $('#user-saml-general input[type="checkbox"]').change(function(e) {
+ $('#user-saml-global input[type="checkbox"]').change(function(e) {
var el = $(this);
$.when(el.focusout()).then(function() {
var key = $(this).attr('name');
@@ -216,6 +231,19 @@ $(function() {
if(key === 'require_provisioned_account') {
$('#user-saml-attribute-mapping').toggleClass('hidden');
}
+ OCA.User_SAML.Admin.setSamlConfigValue('general', key, $(this).val(), true);
+ });
+ });
+
+ $('#user-saml-general input[type="checkbox"]').change(function(e) {
+ var el = $(this);
+ $.when(el.focusout()).then(function() {
+ var key = $(this).attr('name');
+ if($(this).val() === "0") {
+ $(this).val("1");
+ } else {
+ $(this).val("0");
+ }
OCA.User_SAML.Admin.setSamlConfigValue('general', key, $(this).val());
});
});