mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
fix(team): disable team leader setting when external auth sync is enabled [EE-3579] (#7852)
This commit is contained in:
parent
55211ef00e
commit
cb9fe2606c
6 changed files with 36 additions and 0 deletions
|
@ -147,6 +147,7 @@ export const componentsModule = angular
|
||||||
'name',
|
'name',
|
||||||
'placeholder',
|
'placeholder',
|
||||||
'teams',
|
'teams',
|
||||||
|
'disabled',
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
.component(
|
.component(
|
||||||
|
|
|
@ -118,9 +118,20 @@
|
||||||
data-cy="'user-teamSelect'"
|
data-cy="'user-teamSelect'"
|
||||||
on-change="(onChangeTeamIds)"
|
on-change="(onChangeTeamIds)"
|
||||||
input-id="'teams-selector'"
|
input-id="'teams-selector'"
|
||||||
|
disabled="teamSync"
|
||||||
></teams-selector>
|
></teams-selector>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group" ng-if="teamSync">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<span class="small">
|
||||||
|
<p class="small text-muted vertical-center">
|
||||||
|
<pr-icon icon="'alert-circle'" feather="true" class-name="'icon-warning =vertical-center'"></pr-icon>
|
||||||
|
The team leader feature is disabled as external authentication is currently enabled with team sync.
|
||||||
|
</p>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- !teams -->
|
<!-- !teams -->
|
||||||
<div class="form-group" ng-if="isAdmin && !formValues.Administrator && formValues.Teams.length === 0">
|
<div class="form-group" ng-if="isAdmin && !formValues.Administrator && formValues.Teams.length === 0">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
|
|
|
@ -131,6 +131,7 @@ angular.module('portainer.app').controller('UsersController', [
|
||||||
$scope.teams = _.orderBy(data.teams, 'Name', 'asc');
|
$scope.teams = _.orderBy(data.teams, 'Name', 'asc');
|
||||||
$scope.AuthenticationMethod = data.settings.AuthenticationMethod;
|
$scope.AuthenticationMethod = data.settings.AuthenticationMethod;
|
||||||
$scope.requiredPasswordLength = data.settings.RequiredPasswordLength;
|
$scope.requiredPasswordLength = data.settings.RequiredPasswordLength;
|
||||||
|
$scope.teamSync = data.settings.TeamSync;
|
||||||
})
|
})
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
Notifications.error('Failure', err, 'Unable to retrieve users and teams');
|
Notifications.error('Failure', err, 'Unable to retrieve users and teams');
|
||||||
|
|
|
@ -10,6 +10,7 @@ interface Props {
|
||||||
dataCy?: string;
|
dataCy?: string;
|
||||||
inputId?: string;
|
inputId?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TeamsSelector({
|
export function TeamsSelector({
|
||||||
|
@ -20,6 +21,7 @@ export function TeamsSelector({
|
||||||
dataCy,
|
dataCy,
|
||||||
inputId,
|
inputId,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
disabled,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const options = teams.map((team) => ({ label: team.Name, value: team.Id }));
|
const options = teams.map((team) => ({ label: team.Name, value: team.Id }));
|
||||||
|
|
||||||
|
@ -33,6 +35,7 @@ export function TeamsSelector({
|
||||||
data-cy={dataCy}
|
data-cy={dataCy}
|
||||||
inputId={inputId}
|
inputId={inputId}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ interface Props {
|
||||||
dataCy?: string;
|
dataCy?: string;
|
||||||
inputId?: string;
|
inputId?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UsersSelector({
|
export function UsersSelector({
|
||||||
|
@ -20,6 +21,7 @@ export function UsersSelector({
|
||||||
dataCy,
|
dataCy,
|
||||||
inputId,
|
inputId,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
disabled,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
|
@ -36,6 +38,7 @@ export function UsersSelector({
|
||||||
data-cy={dataCy}
|
data-cy={dataCy}
|
||||||
inputId={inputId}
|
inputId={inputId}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
|
isDisabled={disabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,14 @@ import { useReducer } from 'react';
|
||||||
import { Icon } from '@/react/components/Icon';
|
import { Icon } from '@/react/components/Icon';
|
||||||
import { User } from '@/portainer/users/types';
|
import { User } from '@/portainer/users/types';
|
||||||
import { notifySuccess } from '@/portainer/services/notifications';
|
import { notifySuccess } from '@/portainer/services/notifications';
|
||||||
|
import { usePublicSettings } from '@/react/portainer/settings/queries';
|
||||||
|
|
||||||
import { FormControl } from '@@/form-components/FormControl';
|
import { FormControl } from '@@/form-components/FormControl';
|
||||||
import { Widget } from '@@/Widget';
|
import { Widget } from '@@/Widget';
|
||||||
import { Input } from '@@/form-components/Input';
|
import { Input } from '@@/form-components/Input';
|
||||||
import { UsersSelector } from '@@/UsersSelector';
|
import { UsersSelector } from '@@/UsersSelector';
|
||||||
import { LoadingButton } from '@@/buttons/LoadingButton';
|
import { LoadingButton } from '@@/buttons/LoadingButton';
|
||||||
|
import { TextTip } from '@@/Tip/TextTip';
|
||||||
|
|
||||||
import { createTeam } from '../../teams.service';
|
import { createTeam } from '../../teams.service';
|
||||||
import { Team } from '../../types';
|
import { Team } from '../../types';
|
||||||
|
@ -26,6 +28,9 @@ interface Props {
|
||||||
export function CreateTeamForm({ users, teams }: Props) {
|
export function CreateTeamForm({ users, teams }: Props) {
|
||||||
const addTeamMutation = useAddTeamMutation();
|
const addTeamMutation = useAddTeamMutation();
|
||||||
const [formKey, incFormKey] = useReducer((state: number) => state + 1, 0);
|
const [formKey, incFormKey] = useReducer((state: number) => state + 1, 0);
|
||||||
|
const teamSyncQuery = usePublicSettings<boolean>({
|
||||||
|
select: (settings) => settings.TeamSync,
|
||||||
|
});
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -95,10 +100,22 @@ export function CreateTeamForm({ users, teams }: Props) {
|
||||||
dataCy="team-teamLeaderSelect"
|
dataCy="team-teamLeaderSelect"
|
||||||
inputId="users-input"
|
inputId="users-input"
|
||||||
placeholder="Select one or more team leaders"
|
placeholder="Select one or more team leaders"
|
||||||
|
disabled={teamSyncQuery.data}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{teamSyncQuery.data && (
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="col-sm-12">
|
||||||
|
<TextTip color="orange">
|
||||||
|
The team leader feature is disabled as external
|
||||||
|
authentication is currently enabled with team sync.
|
||||||
|
</TextTip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<div className="col-sm-12">
|
<div className="col-sm-12">
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue