1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 05:45:22 +02:00

fix(access-control): show only environment users [EE-6315] (#10614)

This commit is contained in:
Chaim Lev-Ari 2023-11-15 09:33:29 +02:00 committed by GitHub
parent 3525a1af77
commit 51474262eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 53 additions and 38 deletions

View file

@ -187,6 +187,7 @@ export function CreateContainerInstanceForm() {
onChange={(values) => setFieldValue('accessControl', values)}
values={values.accessControl}
errors={errors.accessControl}
environmentId={environmentId}
/>
<div className="form-group">

View file

@ -169,6 +169,7 @@ export function BaseForm({
}
errors={errors?.accessControl}
values={values.accessControl}
environmentId={environment.Id}
/>
<div className="form-group">

View file

@ -43,7 +43,12 @@ function Template({ userRole }: Args) {
return (
<QueryClientProvider client={testQueryClient}>
<UserContext.Provider value={userProviderState}>
<AccessControlForm values={value} onChange={setValue} errors={{}} />
<AccessControlForm
values={value}
onChange={setValue}
errors={{}}
environmentId={1}
/>
</UserContext.Provider>
</QueryClientProvider>
);

View file

@ -315,6 +315,7 @@ async function renderComponent(
const renderResult = renderWithQueryClient(
<UserContext.Provider value={state}>
<AccessControlForm
environmentId={1}
errors={{}}
values={values}
onChange={onChange}

View file

@ -7,6 +7,7 @@ import { SwitchField } from '@@/form-components/SwitchField';
import { EditDetails } from '../EditDetails';
import { ResourceControlOwnership, AccessControlFormData } from '../types';
import { EnvironmentId } from '../../environments/types';
export interface Props {
values: AccessControlFormData;
@ -14,6 +15,7 @@ export interface Props {
hideTitle?: boolean;
formNamespace?: string;
errors?: FormikErrors<AccessControlFormData>;
environmentId: EnvironmentId;
}
export function AccessControlForm({
@ -22,6 +24,7 @@ export function AccessControlForm({
hideTitle,
formNamespace,
errors,
environmentId,
}: Props) {
const { isAdmin } = useUser();
@ -50,6 +53,7 @@ export function AccessControlForm({
values={values}
errors={errors}
formNamespace={formNamespace}
environmentId={environmentId}
/>
)}
</>

View file

@ -30,7 +30,7 @@ interface Props {
resourceType: ResourceControlType;
resourceId: ResourceId;
resourceControl?: ResourceControlViewModel;
environmentId?: EnvironmentId;
environmentId: EnvironmentId;
onCancelClick(): void;
onUpdateSuccess(): Promise<void>;
}

View file

@ -19,7 +19,7 @@ interface Props {
isPublicVisible?: boolean;
errors?: FormikErrors<AccessControlFormData>;
formNamespace?: string;
environmentId?: EnvironmentId;
environmentId: EnvironmentId;
}
export function EditDetails({

View file

@ -2,7 +2,7 @@ import { useTeams } from '@/react/portainer/users/teams/queries';
import { useUsers } from '@/portainer/users/queries';
import { EnvironmentId } from '@/react/portainer/environments/types';
export function useLoadState(environmentId?: EnvironmentId, enabled = true) {
export function useLoadState(environmentId: EnvironmentId, enabled = true) {
const teams = useTeams(false, environmentId);
const users = useUsers(false, environmentId, enabled);