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:
parent
3525a1af77
commit
51474262eb
17 changed files with 53 additions and 38 deletions
|
@ -187,6 +187,7 @@ export function CreateContainerInstanceForm() {
|
|||
onChange={(values) => setFieldValue('accessControl', values)}
|
||||
values={values.accessControl}
|
||||
errors={errors.accessControl}
|
||||
environmentId={environmentId}
|
||||
/>
|
||||
|
||||
<div className="form-group">
|
||||
|
|
|
@ -169,6 +169,7 @@ export function BaseForm({
|
|||
}
|
||||
errors={errors?.accessControl}
|
||||
values={values.accessControl}
|
||||
environmentId={environment.Id}
|
||||
/>
|
||||
|
||||
<div className="form-group">
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
|
|
|
@ -315,6 +315,7 @@ async function renderComponent(
|
|||
const renderResult = renderWithQueryClient(
|
||||
<UserContext.Provider value={state}>
|
||||
<AccessControlForm
|
||||
environmentId={1}
|
||||
errors={{}}
|
||||
values={values}
|
||||
onChange={onChange}
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
|
|
@ -30,7 +30,7 @@ interface Props {
|
|||
resourceType: ResourceControlType;
|
||||
resourceId: ResourceId;
|
||||
resourceControl?: ResourceControlViewModel;
|
||||
environmentId?: EnvironmentId;
|
||||
environmentId: EnvironmentId;
|
||||
onCancelClick(): void;
|
||||
onUpdateSuccess(): Promise<void>;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ interface Props {
|
|||
isPublicVisible?: boolean;
|
||||
errors?: FormikErrors<AccessControlFormData>;
|
||||
formNamespace?: string;
|
||||
environmentId?: EnvironmentId;
|
||||
environmentId: EnvironmentId;
|
||||
}
|
||||
|
||||
export function EditDetails({
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue