mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: make service accounts a Premium feature (#24020)
This commit is contained in:
Generated
+2
@@ -3511,6 +3511,7 @@ export type FeatureName =
|
||||
| "multiple_external_auth"
|
||||
| "multiple_organizations"
|
||||
| "scim"
|
||||
| "service_accounts"
|
||||
| "task_batch_actions"
|
||||
| "template_rbac"
|
||||
| "user_limit"
|
||||
@@ -3539,6 +3540,7 @@ export const FeatureNames: FeatureName[] = [
|
||||
"multiple_external_auth",
|
||||
"multiple_organizations",
|
||||
"scim",
|
||||
"service_accounts",
|
||||
"task_batch_actions",
|
||||
"template_rbac",
|
||||
"user_limit",
|
||||
|
||||
@@ -17,6 +17,7 @@ const meta: Meta<typeof CreateUserForm> = {
|
||||
onCancel: action("cancel"),
|
||||
onSubmit: action("submit"),
|
||||
isLoading: false,
|
||||
serviceAccountsEnabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ interface CreateUserFormProps {
|
||||
onCancel: () => void;
|
||||
authMethods?: TypesGen.AuthMethods;
|
||||
showOrganizations: boolean;
|
||||
serviceAccountsEnabled: boolean;
|
||||
}
|
||||
|
||||
export const CreateUserForm: FC<CreateUserFormProps> = ({
|
||||
@@ -96,12 +97,13 @@ export const CreateUserForm: FC<CreateUserFormProps> = ({
|
||||
onCancel,
|
||||
showOrganizations,
|
||||
authMethods,
|
||||
serviceAccountsEnabled,
|
||||
}) => {
|
||||
const availableLoginTypes = [
|
||||
authMethods?.password.enabled && "password",
|
||||
authMethods?.oidc.enabled && "oidc",
|
||||
authMethods?.github.enabled && "github",
|
||||
"none",
|
||||
serviceAccountsEnabled && "none",
|
||||
].filter(Boolean) as Array<keyof typeof loginTypeOptions>;
|
||||
|
||||
const defaultLoginType = availableLoginTypes[0];
|
||||
|
||||
@@ -6,6 +6,7 @@ import { getErrorDetail, getErrorMessage } from "#/api/errors";
|
||||
import { authMethods, createUser } from "#/api/queries/users";
|
||||
import { Margins } from "#/components/Margins/Margins";
|
||||
import { useDashboard } from "#/modules/dashboard/useDashboard";
|
||||
import { useFeatureVisibility } from "#/modules/dashboard/useFeatureVisibility";
|
||||
import { pageTitle } from "#/utils/page";
|
||||
import { CreateUserForm } from "./CreateUserForm";
|
||||
|
||||
@@ -15,6 +16,7 @@ const CreateUserPage: FC = () => {
|
||||
const createUserMutation = useMutation(createUser(queryClient));
|
||||
const authMethodsQuery = useQuery(authMethods());
|
||||
const { showOrganizations } = useDashboard();
|
||||
const { service_accounts: serviceAccountsEnabled } = useFeatureVisibility();
|
||||
|
||||
return (
|
||||
<Margins>
|
||||
@@ -58,6 +60,7 @@ const CreateUserPage: FC = () => {
|
||||
}}
|
||||
authMethods={authMethodsQuery.data}
|
||||
showOrganizations={showOrganizations}
|
||||
serviceAccountsEnabled={serviceAccountsEnabled}
|
||||
/>
|
||||
</Margins>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user