mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
* feat(stacks): add a setting to disable the creation of stacks for non-admin users * feat(settings): introduce a setting to prevent non-admin from stack creation * feat(settings): update stack creation setting * feat(settings): fail stack creation if user is non admin * fix(settings): save preventStackCreation setting to state * feat(stacks): disable add button when settings is enabled * format(stacks): remove line * feat(stacks): setting to hide stacks from users * feat(settings): rename disable stacks setting * refactor(settings): rename setting to disableStackManagementForRegularUsers * feat(settings): hide stacks for non admin when settings is set * refactor(settings): replace disableDeviceMapping with allow * feat(dashboard): hide stacks if settings disabled and non admin * refactor(sidebar): check if user is endpoint admin * feat(settings): set the default value for stack management * feat(settings): rename field label * fix(sidebar): refresh show stacks state * fix(docker): hide stacks when not admin
66 lines
3 KiB
JavaScript
66 lines
3 KiB
JavaScript
export function SettingsViewModel(data) {
|
|
this.LogoURL = data.LogoURL;
|
|
this.BlackListedLabels = data.BlackListedLabels;
|
|
this.AuthenticationMethod = data.AuthenticationMethod;
|
|
this.LDAPSettings = data.LDAPSettings;
|
|
this.OAuthSettings = new OAuthSettingsViewModel(data.OAuthSettings);
|
|
this.AllowBindMountsForRegularUsers = data.AllowBindMountsForRegularUsers;
|
|
this.AllowPrivilegedModeForRegularUsers = data.AllowPrivilegedModeForRegularUsers;
|
|
this.AllowVolumeBrowserForRegularUsers = data.AllowVolumeBrowserForRegularUsers;
|
|
this.AllowHostNamespaceForRegularUsers = data.AllowHostNamespaceForRegularUsers;
|
|
this.AllowDeviceMappingForRegularUsers = data.AllowDeviceMappingForRegularUsers;
|
|
this.AllowStackManagementForRegularUsers = data.AllowStackManagementForRegularUsers;
|
|
this.SnapshotInterval = data.SnapshotInterval;
|
|
this.TemplatesURL = data.TemplatesURL;
|
|
this.EnableHostManagementFeatures = data.EnableHostManagementFeatures;
|
|
this.EdgeAgentCheckinInterval = data.EdgeAgentCheckinInterval;
|
|
this.EnableEdgeComputeFeatures = data.EnableEdgeComputeFeatures;
|
|
this.UserSessionTimeout = data.UserSessionTimeout;
|
|
}
|
|
|
|
export function PublicSettingsViewModel(settings) {
|
|
this.AllowBindMountsForRegularUsers = settings.AllowBindMountsForRegularUsers;
|
|
this.AllowPrivilegedModeForRegularUsers = settings.AllowPrivilegedModeForRegularUsers;
|
|
this.AllowVolumeBrowserForRegularUsers = settings.AllowVolumeBrowserForRegularUsers;
|
|
this.AllowDeviceMappingForRegularUsers = settings.AllowDeviceMappingForRegularUsers;
|
|
this.AllowStackManagementForRegularUsers = settings.AllowStackManagementForRegularUsers;
|
|
this.AuthenticationMethod = settings.AuthenticationMethod;
|
|
this.EnableHostManagementFeatures = settings.EnableHostManagementFeatures;
|
|
this.EnableEdgeComputeFeatures = settings.EnableEdgeComputeFeatures;
|
|
this.LogoURL = settings.LogoURL;
|
|
this.OAuthLoginURI = settings.OAuthLoginURI;
|
|
}
|
|
|
|
export function LDAPSettingsViewModel(data) {
|
|
this.ReaderDN = data.ReaderDN;
|
|
this.Password = data.Password;
|
|
this.URL = data.URL;
|
|
this.SearchSettings = data.SearchSettings;
|
|
this.GroupSearchSettings = data.GroupSearchSettings;
|
|
this.AutoCreateUsers = data.AutoCreateUsers;
|
|
}
|
|
|
|
export function LDAPSearchSettings(BaseDN, UsernameAttribute, Filter) {
|
|
this.BaseDN = BaseDN;
|
|
this.UsernameAttribute = UsernameAttribute;
|
|
this.Filter = Filter;
|
|
}
|
|
|
|
export function LDAPGroupSearchSettings(GroupBaseDN, GroupAttribute, GroupFilter) {
|
|
this.GroupBaseDN = GroupBaseDN;
|
|
this.GroupAttribute = GroupAttribute;
|
|
this.GroupFilter = GroupFilter;
|
|
}
|
|
|
|
export function OAuthSettingsViewModel(data) {
|
|
this.ClientID = data.ClientID;
|
|
this.ClientSecret = data.ClientSecret;
|
|
this.AccessTokenURI = data.AccessTokenURI;
|
|
this.AuthorizationURI = data.AuthorizationURI;
|
|
this.ResourceURI = data.ResourceURI;
|
|
this.RedirectURI = data.RedirectURI;
|
|
this.UserIdentifier = data.UserIdentifier;
|
|
this.Scopes = data.Scopes;
|
|
this.OAuthAutoCreateUsers = data.OAuthAutoCreateUsers;
|
|
this.DefaultTeamID = data.DefaultTeamID;
|
|
}
|