From 80d570861dbafef1a661cb5efa9984a6cf3c1b4f Mon Sep 17 00:00:00 2001 From: Chaim Lev Ari Date: Wed, 16 Jan 2019 17:34:12 +0200 Subject: [PATCH] refactor(auth): move public settings into view model --- app/portainer/models/settings.js | 10 ++++++++++ app/portainer/services/api/settingsService.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/portainer/models/settings.js b/app/portainer/models/settings.js index cbf0c958a..6da0e8883 100644 --- a/app/portainer/models/settings.js +++ b/app/portainer/models/settings.js @@ -16,6 +16,16 @@ function SettingsViewModel(data) { this.EnableHostManagementFeatures = data.EnableHostManagementFeatures; } +function PublicSettingsViewModel(settings) { + this.AllowBindMountsForRegularUsers = settings.AllowBindMountsForRegularUsers; + this.AllowPrivilegedModeForRegularUsers = settings.AllowPrivilegedModeForRegularUsers; + this.AuthenticationMethod = settings.AuthenticationMethod; + this.EnableHostManagementFeatures = settings.EnableHostManagementFeatures; + this.ExternalTemplates = settings.ExternalTemplates; + this.LogoURL = settings.LogoURL; + this.OAuthLoginURI = settings.OAuthLoginURI; +} + function LDAPSettingsViewModel(data) { this.ReaderDN = data.ReaderDN; this.Password = data.Password; diff --git a/app/portainer/services/api/settingsService.js b/app/portainer/services/api/settingsService.js index a725ce09c..c228e47bf 100644 --- a/app/portainer/services/api/settingsService.js +++ b/app/portainer/services/api/settingsService.js @@ -27,7 +27,7 @@ angular.module('portainer.app') Settings.publicSettings().$promise .then(function success(data) { - var settings = new SettingsViewModel(data); + var settings = new PublicSettingsViewModel(data); deferred.resolve(settings); }) .catch(function error(err) {