Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(frontend): implement maximum role expiration setting (#12160)

boojacka649cbcb62e9
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.go
index 06a663d3f8..2237abe634 100644
--- a/backend/api/v1/project_service.go
+++ b/backend/api/v1/project_service.go
@@ -370,7 +370,7 @@ func (s *ProjectService) SetIamPolicy(ctx context.Context, request *v1pb.SetIamP
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to convert to roles: %v", err)
}
- if err := validateIAMPolicy(request.Policy, roles); err != nil {
+ if err := s.validateIAMPolicy(request.Policy, roles); err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{
@@ -2023,17 +2023,18 @@ func convertToStoreLabelSelectorOperator(operator v1pb.OperatorType) (store.Oper
return store.OperatorType(""), errors.Errorf("invalid operator type: %v", operator)
}
-func validateIAMPolicy(policy *v1pb.IamPolicy, roles []*v1pb.Role) error {
+func (s *ProjectService) validateIAMPolicy(policy *v1pb.IamPolicy, roles []*v1pb.Role) error {
if policy == nil {
return errors.Errorf("IAM Policy is required")
}
- return validateBindings(policy.Bindings, roles)
+ return s.validateBindings(policy.Bindings, roles)
}
-func validateBindings(bindings []*v1pb.Binding, roles []*v1pb.Role) error {
+func (*ProjectService) validateBindings(bindings []*v1pb.Binding, roles []*v1pb.Role) error {
if len(bindings) == 0 {
return errors.Errorf("IAM Binding is required")
}
+
projectRoleMap := make(map[string]bool)
existingRoles := make(map[string]bool)
for _, role := range roles {
@@ -2060,6 +2061,7 @@ func validateBindings(bindings []*v1pb.Binding, roles []*v1pb.Role) error {
}
projectRoleMap[binding.Role] = true
+ // TODO(steven): validate the request time with maximum role expiration.
if _, err := common.ValidateProjectMemberCELExpr(binding.Condition); err != nil {
return err
}
diff --git a/backend/api/v1/project_service_test.go b/backend/api/v1/project_service_test.go
index 5bf30be994..fe5b4b6a6c 100644
--- a/backend/api/v1/project_service_test.go
+++ b/backend/api/v1/project_service_test.go
@@ -172,8 +172,10 @@ func TestValidateBindings(t *testing.T) {
}
a := require.New(t)
+ // Mock an empty project service to test the validateBindings function.
+ projectService := NewProjectService(nil, nil, nil, nil)
for _, tt := range tests {
- err := validateBindings(tt.bindings, tt.roles)
+ err := projectService.validateBindings(tt.bindings, tt.roles)
if tt.wantErr {
a.Error(err)
} else {
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 2c2454d621..addae6135c 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -195,6 +195,12 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *v1pb.Update
if payload.TokenDuration != nil && payload.TokenDuration.Seconds > 0 && payload.TokenDuration.AsDuration() < time.Hour {
return nil, status.Errorf(codes.InvalidArgument, "refresh token duration should be at least one hour")
}
+ if payload.MaximumRoleExpiration != nil {
+ // If the value is less than or equal to 0, we will remove the setting. AKA no limit.
+ if payload.MaximumRoleExpiration.Seconds <= 0 {
+ payload.MaximumRoleExpiration = nil
+ }
+ }
bytes, err := protojson.Marshal(payload)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to marshal setting for %s with error: %v", apiSettingName, err)
diff --git a/frontend/src/components/ExpirationSelector.vue b/frontend/src/components/ExpirationSelector.vue
index d2d19364b4..0c081a506b 100644
--- a/frontend/src/components/ExpirationSelector.vue
+++ b/frontend/src/components/ExpirationSelector.vue
@@ -12,18 +12,24 @@
>
<NRadio :value="option.value" :label="option.label" />
</div>
- <div class="col-span-2 flex flex-row justify-start items-center">
+ <div class="col-span-3 flex flex-row justify-start items-center">
<NRadio :value="-1" :label="$t('issue.grant-request.custom')" />
<NInputNumber
v-model:value="state.customValue"
class="!w-24 ml-2"
:disabled="!useCustom"
:min="1"
+ :max="maximumRoleExpiration"
:show-button="false"
:placeholder="''"
>
<template #suffix>{{ $t("common.date.days") }}</template>
</NInputNumber>
+
+ <span v-if="maximumRoleExpiration" class="ml-3 textinfolabel">
+ {{ $t("settings.general.workspace.maximum-role-expiration.self") }}:
+ {{ $t("common.date.days", { days: maximumRoleExpiration }) }}
+ </span>
</div>
</NRadioGroup>
</template>
@@ -31,6 +37,8 @@
<script lang="ts" setup>
import { NRadio, NRadioGroup, NInputNumber } from "naive-ui";
import { computed, reactive, watch } from "vue";
+import { useI18n } from "vue-i18n";
+import { useSettingV1Store } from "@/store";
interface ExpirationOption {
value: number;
@@ -43,7 +51,6 @@ interface LocalState {
}
const props = defineProps<{
- options: ExpirationOption[];
value: number;
}>();
@@ -51,6 +58,9 @@ const emit = defineEmits<{
(event: "update", value: number): void;
}>();
+const { t } = useI18n();
+const settingV1Store = useSettingV1Store();
+
const state = reactive<LocalState>({
value: props.value,
customValue: 7,
@@ -58,6 +68,51 @@ const state = reactive<LocalState>({
const useCustom = computed(() => state.value === -1);
+const maximumRoleExpiration = computed(() => {
+ const seconds =
+ settingV1Store.workspaceProfileSetting?.maximumRoleExpiration?.seconds?.toNumber();
+ if (!seconds) {
+ return undefined;
+ }
+ return Math.floor(seconds / (60 * 60 * 24));
+});
+
+const options = computed((): ExpirationOption[] => {
+ let options = [
+ {
+ value: 1,
+ label: t("common.date.days", { days: 1 }),
+ },
+ {
+ value: 3,
+ label: t("common.date.days", { days: 3 }),
+ },
+ {
+ value: 30,
+ label: t("common.date.days", { days: 30 }),
+ },
+ {
+ value: 90,
+ label: t("common.date.days", { days: 90 }),
+ },
+ ];
+ if (maximumRoleExpiration.value) {
+ options = options.filter(
+ (option) => option.value <= maximumRoleExpiration.value!
+ );
+ options.push({
+ value: maximumRoleExpiration.value,
+ label: t("common.date.days", { days: maximumRoleExpiration.value }),
+ });
+ } else {
+ options.push({
+ value: 0,
+ label: t("project.members.never-expires"),
+ });
+ }
+ return options;
+});
+
watch(
() => [state.value, state.customValue],
() => {
diff --git a/frontend/src/components/GeneralSetting/MaximumRoleExpirationSetting.vue b/frontend/src/components/GeneralSetting/MaximumRoleExpirationSetting.vue
new file mode 100644
index 0000000000..b1baf745a1
--- /dev/null
+++ b/frontend/src/components/GeneralSetting/MaximumRoleExpirationSetting.vue
@@ -0,0 +1,96 @@
+<template>
+ <div class="mb-7 mt-4 lg:mt-0">
+ <p class="font-medium flex flex-row justify-start items-center">
+ <span class="mr-2">{{
+ $t("settings.general.workspace.maximum-role-expiration.self")
+ }}</span>
+ </p>
+ <p class="text-sm text-gray-400 mt-1">
+ {{ $t("settings.general.workspace.maximum-role-expiration.description") }}
+ </p>
+ <div class="mt-3 w-full flex flex-row justify-start items-center gap-4">
+ <NInputNumber
+ v-model:value="state.inputValue"
+ class="w-40"
+ :disabled="!allowChangeSetting || state.neverExpire"
+ :min="1"
+ :precision="0"
+ >
+ <template #suffix>
+ {{ $t("settings.general.workspace.maximum-role-expiration.days") }}
+ </template>
+ </NInputNumber>
+ <NCheckbox v-model:checked="state.neverExpire" style="margin-right: 12px">
+ {{
+ $t("settings.general.workspace.maximum-role-expiration.never-expires")
+ }}
+ </NCheckbox>
+ </div>
+ </div>
+</template>
+
+<script lang="ts" setup>
+import { useDebounceFn } from "@vueuse/core";
+import { NInputNumber, NCheckbox } from "naive-ui";
+import { computed, reactive, watch } from "vue";
+import { useI18n } from "vue-i18n";
+import { pushNotification } from "@/store";
+import { useSettingV1Store } from "@/store/modules/v1/setting";
+import { Duration } from "@/types/proto/google/protobuf/duration";
+
+const DEFAULT_EXPIRATION_DAYS = 90;
+
+const getInitialState = (): LocalState => {
+ const defaultState: LocalState = {
+ inputValue: DEFAULT_EXPIRATION_DAYS,
+ neverExpire: true,
+ };
+ const seconds =
+ settingV1Store.workspaceProfileSetting?.maximumRoleExpiration?.seconds?.toNumber();
+ if (seconds && seconds > 0) {
+ defaultState.inputValue =
+ Math.floor(seconds / (60 * 60 * 24)) || DEFAULT_EXPIRATION_DAYS;
+ defaultState.neverExpire = false;
+ }
+ return defaultState;
+};
+
+interface LocalState {
+ inputValue: number;
+ neverExpire: boolean;
+}
+
+const props = defineProps<{
+ allowEdit: boolean;
+}>();
+
+const { t } = useI18n();
+const settingV1Store = useSettingV1Store();
+const state = reactive<LocalState>(getInitialState());
+
+const allowChangeSetting = computed(() => {
+ return props.allowEdit;
+});
+
+const handleSettingChange = useDebounceFn(async () => {
+ let seconds = -1;
+ if (!state.neverExpire) {
+ seconds = state.inputValue * 24 * 60 * 60;
+ }
+ await settingV1Store.updateWorkspaceProfile({
+ maximumRoleExpiration: Duration.fromPartial({ seconds, nanos: 0 }),
+ });
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("settings.general.workspace.config-updated"),
+ });
+}, 2000);
+
+watch(
+ () => [state.inputValue, state.neverExpire],
+ () => {
+ handleSettingChange();
+ }
+);
+</script>
diff --git a/frontend/src/components/GeneralSetting/SecuritySetting.vue b/frontend/src/components/GeneralSetting/SecuritySetting.vue
index 531a1cc47c..01754157b4 100644
--- a/frontend/src/components/GeneralSetting/SecuritySetting.vue
+++ b/frontend/src/components/GeneralSetting/SecuritySetting.vue
@@ -113,6 +113,7 @@
</div>
</div>
<SignInFrequencySetting :allow-edit="allowEdit" />
+ <MaximumRoleExpirationSetting :allow-edit="allowEdit" />
</div>
</div>
diff --git a/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue b/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
index f34c93fabd..002cf05caa 100644
--- a/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
+++ b/frontend/src/components/GeneralSetting/SignInFrequencySetting.vue
@@ -14,7 +14,7 @@
<div class="mt-3 w-full flex flex-row justify-start items-center">
<NInputNumber
v-model:value="state.inputValue"
- class="w-20 mr-4"
+ class="w-24 mr-4"
:disabled="!allowChangeSetting"
:min="1"
:max="state.timeFormat === 'HOURS' ? 23 : undefined"
diff --git a/frontend/src/components/Issue/panel/RequestExportPanel/index.vue b/frontend/src/components/Issue/panel/RequestExportPanel/index.vue
index 560ac80499..8b326df949 100644
--- a/frontend/src/components/Issue/panel/RequestExportPanel/index.vue
+++ b/frontend/src/components/Issue/panel/RequestExportPanel/index.vue
@@ -55,7 +55,6 @@
</span>
<ExpirationSelector
class="grid-cols-3 sm:grid-cols-4 md:grid-cols-6"
- :options="expireDaysOptions"
:value="state.expireDays"
@update="state.expireDays = $event"
/>
@@ -155,25 +154,6 @@ const state = reactive<LocalState>({
description: "",
});
-const expireDaysOptions = computed(() => [
- {
- value: 1,
- label: t("common.date.days", { days: 1 }),
- },
- {
- value: 3,
- label: t("common.date.days", { days: 3 }),
- },
- {
- value: 7,
- label: t("common.date.days", { days: 7 }),
- },
- {
- value: 15,
- label: t("common.date.days", { days: 15 }),
- },
-]);
-
const allowCreate = computed(() => {
if (!state.projectId) {
return false;
diff --git a/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue b/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue
index c82dc4e596..cb7f372b65 100644
--- a/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue
+++ b/frontend/src/components/Issue/panel/RequestQueryPanel/index.vue
@@ -45,7 +45,6 @@
</span>
<ExpirationSelector
class="grid-cols-3 sm:grid-cols-4"
- :options="expireDaysOptions"
:value="state.expireDays"
@update="state.expireDays = $event"
/>
@@ -83,7 +82,6 @@ import dayjs from "dayjs";
import { isUndefined, uniq } from "lodash-es";
import { NButton, NInput } from "naive-ui";
import { computed, reactive } from "vue";
-import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import ExpirationSelector from "@/components/ExpirationSelector.vue";
import RequiredStar from "@/components/RequiredStar.vue";
@@ -143,44 +141,16 @@ const extractDatabaseResourcesFromProps = (): Pick<
};
};
-const { t } = useI18n();
const router = useRouter();
const databaseStore = useDatabaseV1Store();
const currentUser = useCurrentUserV1();
const state = reactive<LocalState>({
projectId: props.projectId,
...extractDatabaseResourcesFromProps(),
- expireDays: 7,
+ expireDays: 1,
description: "",
});
-const expireDaysOptions = computed(() => [
- {
- value: 7,
- label: t("common.date.days", { days: 7 }),
- },
- {
- value: 30,
- label: t("common.date.days", { days: 30 }),
- },
- {
- value: 60,
- label: t("common.date.days", { days: 60 }),
- },
- {
- value: 90,
- label: t("common.date.days", { days: 90 }),
- },
- {
- value: 180,
- label: t("common.date.months", { months: 6 }),
- },
- {
- value: 365,
- label: t("common.date.years", { years: 1 }),
- },
-]);
-
const allowCreate = computed(() => {
if (!state.projectId) {
return false;
diff --git a/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue b/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue
index 4c857c4f54..9730b91507 100644
--- a/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue
+++ b/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue
@@ -87,7 +87,6 @@
<span>{{ $t("common.expiration") }}</span>
<ExpirationSelector
class="grid-cols-3 sm:grid-cols-4"
- :options="expireDaysOptions"
:value="state.expireDays"
@update="state.expireDays = $event"
/>
@@ -100,12 +99,16 @@
import dayjs from "dayjs";
import { head } from "lodash-es";
import { NInputNumber, NInput, NRadioGroup, NRadio } from "naive-ui";
-import { computed, onMounted, reactive, watch } from "vue";
-import { useI18n } from "vue-i18n";
+import { computed, reactive, watch } from "vue";
import ExpirationSelector from "@/components/ExpirationSelector.vue";
import QuerierDatabaseResourceForm from "@/components/Issue/panel/RequestQueryPanel/DatabaseResourceForm/index.vue";
import { ProjectRoleSelect, UserGroupSelect } from "@/components/v2/Select";
-import { useUserStore, useUserGroupStore, extractGroupEmail } from "@/store";
+import {
+ useUserStore,
+ useUserGroupStore,
+ extractGroupEmail,
+ useSettingV1Store,
+} from "@/store";
import { userGroupNamePrefix } from "@/store/modules/v1/common";
import type { ComposedProject, DatabaseResource } from "@/types";
import {
@@ -145,46 +148,20 @@ interface LocalState {
databaseId?: string;
}
-const { t } = useI18n();
-const userStore = useUserStore();
-const groupStore = useUserGroupStore();
-
-const state = reactive<LocalState>({
- type: "MEMBER",
- memberList: [],
- reason: "",
- // Default is never expires.
- expireDays: 0,
- // Exporter options.
- maxRowCount: 1000,
-});
-
-watch(
- () => state.type,
- (type) => {
- if (
- type === "MEMBER" &&
- !state.memberList.every((m) => !m.startsWith(userGroupNamePrefix))
- ) {
- state.memberList = [];
- } else if (
- !state.memberList.every((m) => m.startsWith(userGroupNamePrefix))
- ) {
- state.memberList = [];
- }
- }
-);
-
-onMounted(() => {
- if (!props.binding) {
- return;
- }
-
+const getInitialState = (): LocalState => {
+ const defaultState: LocalState = {
+ type: "MEMBER",
+ memberList: [],
+ reason: "",
+ // Default to never expire.
+ expireDays: 0,
+ maxRowCount: 1000,
+ };
const isMember = props.binding.members.some((member) =>
member.startsWith("user:")
);
if (isMember || props.binding.members.length === 0) {
- state.type = "MEMBER";
+ defaultState.type = "MEMBER";
const userUidList = [];
for (const member of props.binding.members) {
if (member.startsWith("group:")) {
@@ -195,9 +172,9 @@ onMounted(() => {
userUidList.push(extractUserUID(user.name));
}
}
- state.memberList = userUidList;
+ defaultState.memberList = userUidList;
} else {
- state.type = "GROUP";
+ defaultState.type = "GROUP";
const groupNameList = [];
for (const member of props.binding.members) {
if (!member.startsWith("group:")) {
@@ -209,59 +186,45 @@ onMounted(() => {
}
groupNameList.push(group.name);
}
- state.memberList = groupNameList;
+ defaultState.memberList = groupNameList;
}
-});
-const expireDaysOptions = computed(() => {
- if (state.role === PresetRoleType.PROJECT_EXPORTER) {
- return [
- {
- value: 1,
- label: t("common.date.days", { days: 1 }),
- },
- {
- value: 3,
- label: t("common.date.days", { days: 3 }),
- },
- {
- value: 30,
- label: t("common.date.days", { days: 30 }),
- },
- {
- value: 90,
- label: t("common.date.days", { days: 90 }),
- },
- {
- value: 0,
- label: t("project.members.never-expires"),
- },
- ];
+ if (maximumRoleExpiration.value) {
+ defaultState.expireDays = maximumRoleExpiration.value;
+ }
+ return defaultState;
+};
+
+const maximumRoleExpiration = computed(() => {
+ const seconds =
+ settingV1Store.workspaceProfileSetting?.maximumRoleExpiration?.seconds?.toNumber();
+ if (!seconds) {
+ return undefined;
}
- return [
- {
- value: 7,
- label: t("common.date.days", { days: 7 }),
- },
- {
- value: 30,
- label: t("common.date.days", { days: 30 }),
- },
- {
- value: 90,
- label: t("common.date.days", { days: 90 }),
- },
- {
- value: 365,
- label: t("common.date.years", { years: 1 }),
- },
- {
- value: 0,
- label: t("project.members.never-expires"),
- },
- ];
+ return Math.floor(seconds / (60 * 60 * 24));
});
+const userStore = useUserStore();
+const groupStore = useUserGroupStore();
+const settingV1Store = useSettingV1Store();
+const state = reactive<LocalState>(getInitialState());
+
+watch(
+ () => state.type,
+ (type) => {
+ if (
+ type === "MEMBER" &&
+ !state.memberList.every((m) => !m.startsWith(userGroupNamePrefix))
+ ) {
+ state.memberList = [];
+ } else if (
+ !state.memberList.every((m) => m.startsWith(userGroupNamePrefix))
+ ) {
+ state.memberList = [];
+ }
+ }
+);
+
watch(
() => state.role,
() => {
diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
index 1d6d199ce2..4db71faee3 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
@@ -13,10 +13,12 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from "vue";
+import { useRouter } from "vue-router";
import { issueServiceClient } from "@/grpcweb";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { pushNotification } from "@/store";
import { UNKNOWN_ID } from "@/types";
-import { issueSlug } from "@/utils";
+import { extractProjectResourceName, issueSlug } from "@/utils";
type DescriptionType = "TEXT" | "ISSUE";
@@ -29,6 +31,7 @@ const props = defineProps({
},
});
+const router = useRouter();
const issueUID = ref(String(UNKNOWN_ID));
const descriptionType = computed<DescriptionType>(() => {
@@ -51,7 +54,14 @@ const gotoIssuePage = async () => {
return;
}
- window.open(`/issue/${issueSlug(issue.title, issue.uid)}`, "_blank");
+ const route = router.resolve({
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(issue.name),
+ issueSlug: issueSlug(issue.title, issue.uid),
+ },
+ });
+ window.open(route.href, "_blank");
};
onMounted(() => {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 1eb83c33fe..3117cf549f 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -660,6 +660,12 @@
"days": "Day(s)",
"config-updated": "Configuration is updated. Need to restart Bytebase and re-login to take effect."
},
+ "maximum-role-expiration": {
+ "self": "Maximum role expiration",
+ "description": "Maximum role expiration is the maximum period a role can be granted to a user.",
+ "days": "Day(s)",
+ "never-expires": "Never expires"
+ },
"config-updated": "Configuration is updated.",
"plugin": {
"openai": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index fa25bacc6c..5c04747701 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -660,6 +660,12 @@
"days": "Días",
"config-updated": "La configuración se ha actualizado. Necesita reiniciar Bytebase y volver a iniciar sesión para que surta efecto."
},
+ "maximum-role-expiration": {
+ "self": "Caducidad máxima del rol",
+ "description": "La caducidad máxima de la función es el período máximo que se puede otorgar una función a un usuario.",
+ "days": "Días)",
+ "never-expires": "Nunca expira"
+ },
"config-updated": "La configuración se ha actualizado.",
"plugin": {
"openai": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 38872fc595..2f1797dfff 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -660,6 +660,12 @@
"days": "日々",
"config-updated": "構成が更新されたため、有効にするには Bytebase を再起動し、再度ログインする必要があります。"
},
+ "maximum-role-expiration": {
+ "self": "最大ロール有効期限",
+ "description": "最大ロール有効期限は、ユーザーにロールを付与できる最大期間です。",
+ "days": "日々)",
+ "never-expires": "期限切れなし"
+ },
"config-updated": "構成が更新されました。",
"plugin": {
"openai": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 02faf01b63..7b7b4b874d 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -660,6 +660,12 @@
"days": "天数",
"config-updated": "配置已更新,需要重新启动 Bytebase 以及重新登录后生效。"
},
+ "maximum-role-expiration": {
+ "self": "角色最大过期时间",
+ "description": "角色最大过期时间是可以赋予用户角色时所能设置的最大过期时间。",
+ "days": "天数",
+ "never-expires": "永不过期"
+ },
"config-updated": "配置已更新。",
"plugin": {
"openai": {