From 3f31d4b00bc46c05b2555bff31dd8e88e9b0f656 Mon Sep 17 00:00:00 2001
From: fhanportainer <79428273+fhanportainer@users.noreply.github.com>
Date: Mon, 29 Nov 2021 10:41:21 +1300
Subject: [PATCH] feat(ce): fix small issues for Highlight Business Edition
feature (#6043)
* feat(logs): added orange border to export button.
* fix(ldap): fixed connectivity check radio button alignment issue
* fix(be-feature): added box shadow to limited feature border
* fix(be-feature): fixed hide internal auth toggle issue.
* feat(ldap): added isLimitedFeatureSelfContained config to ldap-custom-admin-group and test-login components
* feat(auth): moved save settings button in auth page to a component.
* feat(oauth): use saveSettingsButton component in oauth
* feat(oauth): use saveSettingsButton component in internal auth
* feat(oauth): use saveSettingsButton component in MS active directory auth
* feat(oauth): use saveSettingsButton component in ldap auth
* feat(auth): added new component to index.js
* removed css inline styles.
* feat(ad): added disable check method to ad auth.
* feat(ldap): moved save settings disable method to parent component
* removed inline styles.
* fix(ldap): fixed test login misalignment issue
* fix(ldap): pass isLdapFormValid function from page component
* fix(ldap): made the toggle button in custom admin group orange when it's limited to CE.
* fix(auth): fixed save setting button in Microsoft Active Directory auth
* fix(ldap): made the assign admin toggle bright orange
---
app/assets/css/app.css | 48 ++++++++++++
app/portainer/feature-flags/feature-flags.css | 9 ++-
.../oauth/components/oauth-settings/index.js | 2 +
.../oauth-settings.controller.js | 17 ++++-
.../oauth-settings/oauth-settings.html | 10 ++-
.../settings/authentication/index.js | 7 +-
.../authentication/internal-auth/index.js | 7 ++
.../internal-auth/internal-auth.html | 8 ++
.../ad-settings/ad-settings.controller.js | 7 +-
.../ldap/ad-settings/ad-settings.html | 9 ++-
.../authentication/ldap/ad-settings/index.js | 3 +
.../ldap-connectivity-check.html | 8 +-
.../ldap/ldap-custom-admin-group/index.js | 2 +
.../ldap-custom-admin-group.css | 4 +
.../ldap-custom-admin-group.html | 75 ++++++++++++++-----
.../ldap/ldap-settings-custom/index.js | 4 +
.../ldap-settings-custom.controller.js | 1 -
.../ldap-settings-custom.css | 3 +
.../ldap-settings-custom.html | 61 ++++++++-------
.../ldap/ldap-settings-openldap/index.js | 4 +-
.../ldap-settings-openldap.html | 6 ++
.../ldap/ldap-settings-test-login/index.js | 2 +
.../ldap-settings-test-login.css | 4 +
.../ldap-settings-test-login.html | 31 ++++++--
.../ldap/ldap-settings/index.js | 3 +
.../ldap/ldap-settings/ldap-settings.html | 6 ++
.../save-auth-settings-button/index.js | 11 +++
.../save-auth-settings-button.html | 19 +++++
.../activity-logs-view.html | 4 +-
.../auth-logs-view/auth-logs-view.html | 4 +-
.../settingsAuthentication.html | 43 ++++-------
.../settingsAuthenticationController.js | 3 +-
32 files changed, 328 insertions(+), 97 deletions(-)
create mode 100644 app/portainer/settings/authentication/internal-auth/index.js
create mode 100644 app/portainer/settings/authentication/internal-auth/internal-auth.html
create mode 100644 app/portainer/settings/authentication/ldap/ldap-custom-admin-group/ldap-custom-admin-group.css
create mode 100644 app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.css
create mode 100644 app/portainer/settings/authentication/ldap/ldap-settings-test-login/ldap-settings-test-login.css
create mode 100644 app/portainer/settings/authentication/save-auth-settings-button/index.js
create mode 100644 app/portainer/settings/authentication/save-auth-settings-button/save-auth-settings-button.html
diff --git a/app/assets/css/app.css b/app/assets/css/app.css
index 91b058fe2..1b7693261 100644
--- a/app/assets/css/app.css
+++ b/app/assets/css/app.css
@@ -845,6 +845,54 @@ json-tree .branch-preview {
margin-bottom: 2rem;
}
+.m-l-5 {
+ margin-left: 5px;
+}
+
+.m-l-20 {
+ margin-left: 20px;
+}
+
+.m-l-30 {
+ margin-left: 30px;
+}
+
+.m-r-2 {
+ margin-right: 2px;
+}
+
+.m-r-5 {
+ margin-right: 5px;
+}
+
+.m-t-10 {
+ margin-top: 10px;
+}
+
+.m-t-10 {
+ margin-top: 10px;
+}
+
+.m-b-10 {
+ margin-bottom: 10px;
+}
+
+.no-margin {
+ margin: 0 !important;
+}
+
+.no-border {
+ border: none;
+}
+
+.dispay-flex {
+ display: flex;
+}
+
+.flex-wrap {
+ flex-wrap: wrap;
+}
+
.text-wrap {
word-break: break-all;
white-space: normal;
diff --git a/app/portainer/feature-flags/feature-flags.css b/app/portainer/feature-flags/feature-flags.css
index 9ffda18d8..600296aee 100644
--- a/app/portainer/feature-flags/feature-flags.css
+++ b/app/portainer/feature-flags/feature-flags.css
@@ -6,15 +6,22 @@
border-color: var(--border-form-control-color);
}
-button.limited-be {
+button.limited-be,
+button[disabled].limited-be.oauth-save-settings-button {
background-color: var(--BE-only);
border-color: var(--BE-only);
}
+button.limited-be.oauth-save-settings-button {
+ background-color: var(--blue-2);
+ border-color: transparent;
+}
+
ng-form.limited-be,
form.limited-be,
div.limited-be {
border: solid 1px var(--BE-only);
+ box-shadow: var(--shadow-boxselector-color);
padding: 10px;
pointer-events: none;
touch-action: none;
diff --git a/app/portainer/oauth/components/oauth-settings/index.js b/app/portainer/oauth/components/oauth-settings/index.js
index c7fc2712f..fb452d8cd 100644
--- a/app/portainer/oauth/components/oauth-settings/index.js
+++ b/app/portainer/oauth/components/oauth-settings/index.js
@@ -6,6 +6,8 @@ angular.module('portainer.oauth').component('oauthSettings', {
bindings: {
settings: '=',
teams: '<',
+ onSaveSettings: '<',
+ saveButtonState: '<',
},
controller,
});
diff --git a/app/portainer/oauth/components/oauth-settings/oauth-settings.controller.js b/app/portainer/oauth/components/oauth-settings/oauth-settings.controller.js
index 500560ad7..c67a06be0 100644
--- a/app/portainer/oauth/components/oauth-settings/oauth-settings.controller.js
+++ b/app/portainer/oauth/components/oauth-settings/oauth-settings.controller.js
@@ -8,6 +8,7 @@ export default class OAuthSettingsController {
this.featureService = featureService;
this.limitedFeature = HIDE_INTERNAL_AUTH;
+ this.limitedFeatureClass = 'limited-be';
this.state = {
provider: 'custom',
@@ -61,7 +62,7 @@ export default class OAuthSettingsController {
}
updateSSO() {
- this.settings.HideInternalAuth = this.settings.SSO;
+ this.settings.HideInternalAuth = this.featureService.isLimitedToBE(this.limitedFeature) ? false : this.settings.SSO;
}
addTeamMembershipMapping() {
@@ -72,6 +73,20 @@ export default class OAuthSettingsController {
this.settings.TeamMemberships.OAuthClaimMappings.splice(index, 1);
}
+ isOAuthTeamMembershipFormValid() {
+ if (this.settings.OAuthAutoMapTeamMemberships && this.settings.TeamMemberships) {
+ if (!this.settings.TeamMemberships.OAuthClaimName) {
+ return false;
+ }
+
+ const hasInvalidMapping = this.settings.TeamMemberships.OAuthClaimMappings.some((m) => !(m.ClaimValRegex && m.Team));
+ if (hasInvalidMapping) {
+ return false;
+ }
+ }
+ return true;
+ }
+
$onInit() {
this.isLimitedToBE = this.featureService.isLimitedToBE(this.limitedFeature);
diff --git a/app/portainer/oauth/components/oauth-settings/oauth-settings.html b/app/portainer/oauth/components/oauth-settings/oauth-settings.html
index 4853aabc1..8116cd999 100644
--- a/app/portainer/oauth/components/oauth-settings/oauth-settings.html
+++ b/app/portainer/oauth/components/oauth-settings/oauth-settings.html
@@ -1,4 +1,4 @@
-