mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 10:29:17 +00:00
renamed from temp access to timed access
This commit is contained in:
committed by
Akhil Mohan
parent
4152b3a524
commit
fc57884035
@@ -18,9 +18,12 @@ export const registerOrgRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.trim()
|
.trim()
|
||||||
.refine((val) => Object.keys(OrgMembershipRole).includes(val), "Invalid keyword slugs")
|
.refine(
|
||||||
|
(val) => Object.keys(OrgMembershipRole).includes(val),
|
||||||
|
"Please choose a different slug, the slug you have entered is reserved"
|
||||||
|
)
|
||||||
.refine((v) => slugify(v) === v, {
|
.refine((v) => slugify(v) === v, {
|
||||||
message: "Slug must be a valid slug"
|
message: "Slug must be a valid"
|
||||||
}),
|
}),
|
||||||
name: z.string().trim(),
|
name: z.string().trim(),
|
||||||
description: z.string().trim().optional(),
|
description: z.string().trim().optional(),
|
||||||
@@ -59,10 +62,10 @@ export const registerOrgRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
.optional()
|
.optional()
|
||||||
.refine(
|
.refine(
|
||||||
(val) => typeof val === "undefined" || Object.keys(OrgMembershipRole).includes(val),
|
(val) => typeof val === "undefined" || Object.keys(OrgMembershipRole).includes(val),
|
||||||
"Invalid keyword slugs"
|
"Please choose a different slug, the slug you have entered is reserved."
|
||||||
)
|
)
|
||||||
.refine((val) => typeof val === "undefined" || slugify(val) === val, {
|
.refine((val) => typeof val === "undefined" || slugify(val) === val, {
|
||||||
message: "Slug must be a valid slug"
|
message: "Slug must be a valid"
|
||||||
}),
|
}),
|
||||||
name: z.string().trim().optional(),
|
name: z.string().trim().optional(),
|
||||||
description: z.string().trim().optional(),
|
description: z.string().trim().optional(),
|
||||||
|
|||||||
@@ -148,13 +148,13 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
|||||||
role: z.string(),
|
role: z.string(),
|
||||||
isTemporary: z.literal(true),
|
isTemporary: z.literal(true),
|
||||||
temporaryMode: z.nativeEnum(ProjectUserMembershipTemporaryMode),
|
temporaryMode: z.nativeEnum(ProjectUserMembershipTemporaryMode),
|
||||||
temporaryRange: z.string().refine((val) => ms(val) > 0, "Temporary range must be positive"),
|
temporaryRange: z.string().refine((val) => ms(val) > 0, "Temporary range must be a positive number"),
|
||||||
temporaryAccessStartTime: z.string().datetime()
|
temporaryAccessStartTime: z.string().datetime()
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
.min(1)
|
.min(1)
|
||||||
.refine((data) => data.some(({ isTemporary }) => !isTemporary), "Atleast one permanent role required")
|
.refine((data) => data.some(({ isTemporary }) => !isTemporary), "At least long lived role is required")
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
|||||||
role: z.string(),
|
role: z.string(),
|
||||||
isTemporary: z.literal(true),
|
isTemporary: z.literal(true),
|
||||||
temporaryMode: z.nativeEnum(ProjectUserMembershipTemporaryMode),
|
temporaryMode: z.nativeEnum(ProjectUserMembershipTemporaryMode),
|
||||||
temporaryRange: z.string().refine((val) => ms(val) > 0, "Temporary range must be positive"),
|
temporaryRange: z.string().refine((val) => ms(val) > 0, "Temporary range must be a positive number"),
|
||||||
temporaryAccessStartTime: z.string().datetime()
|
temporaryAccessStartTime: z.string().datetime()
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const TemporaryRoleForm = ({
|
|||||||
>
|
>
|
||||||
<PopoverTrigger>
|
<PopoverTrigger>
|
||||||
<IconButton ariaLabel="role-temp" variant="plain" size="md">
|
<IconButton ariaLabel="role-temp" variant="plain" size="md">
|
||||||
<Tooltip content={isExpired ? "Access Expired" : "Grant Temporary Access"}>
|
<Tooltip content={isExpired ? "Timed access expired" : "Grant timed access"}>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faClock}
|
icon={faClock}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
@@ -93,7 +93,7 @@ const TemporaryRoleForm = ({
|
|||||||
>
|
>
|
||||||
<div className="flex flex-col space-y-4">
|
<div className="flex flex-col space-y-4">
|
||||||
<div className="border-b border-b-gray-700 pb-2 text-sm text-mineshaft-300">
|
<div className="border-b border-b-gray-700 pb-2 text-sm text-mineshaft-300">
|
||||||
Set Role Temporarily
|
Configure timed access
|
||||||
</div>
|
</div>
|
||||||
{isExpired && <Tag colorSchema="red">Expired</Tag>}
|
{isExpired && <Tag colorSchema="red">Expired</Tag>}
|
||||||
<Controller
|
<Controller
|
||||||
@@ -292,12 +292,12 @@ export const MemberRoles = ({
|
|||||||
.map(({ role, customRoleName, id, isTemporary, temporaryAccessEndTime }) => {
|
.map(({ role, customRoleName, id, isTemporary, temporaryAccessEndTime }) => {
|
||||||
const isExpired = new Date() > new Date(temporaryAccessEndTime || ("" as string));
|
const isExpired = new Date() > new Date(temporaryAccessEndTime || ("" as string));
|
||||||
return (
|
return (
|
||||||
<Tag key={id} className="capitalize">
|
<Tag key={id}>
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<div>{formatRoleName(role, customRoleName)}</div>
|
<div>{formatRoleName(role, customRoleName)}</div>
|
||||||
{isTemporary && (
|
{isTemporary && (
|
||||||
<div>
|
<div>
|
||||||
<Tooltip content={isExpired ? "Expired Temporary Access" : "Temporary Access"}>
|
<Tooltip content={isExpired ? "Timed role expired" : "Timed role access"}>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faClock}
|
icon={faClock}
|
||||||
className={twMerge(isExpired && "text-red-600")}
|
className={twMerge(isExpired && "text-red-600")}
|
||||||
@@ -326,7 +326,7 @@ export const MemberRoles = ({
|
|||||||
{isTemporary && (
|
{isTemporary && (
|
||||||
<div>
|
<div>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={isExpired ? "Expired Temporary Access" : "Temporary Access"}
|
content={isExpired ? "Access expired" : "Temporary access"}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faClock}
|
icon={faClock}
|
||||||
|
|||||||
Reference in New Issue
Block a user