mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 02:27:39 +00:00
Fix rebase issue with deleted files
This commit is contained in:
+10
-4
@@ -4,11 +4,14 @@ import { TableName } from "../schemas";
|
|||||||
|
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
if (await knex.schema.hasTable(TableName.Organization)) {
|
if (await knex.schema.hasTable(TableName.Organization)) {
|
||||||
const hasSecretShareToAnyoneCol = await knex.schema.hasColumn(TableName.Organization, "secretShareSendToAnyone");
|
const hasSecretShareToAnyoneCol = await knex.schema.hasColumn(
|
||||||
|
TableName.Organization,
|
||||||
|
"allowSecretSharingOutsideOrganization"
|
||||||
|
);
|
||||||
|
|
||||||
if (!hasSecretShareToAnyoneCol) {
|
if (!hasSecretShareToAnyoneCol) {
|
||||||
await knex.schema.alterTable(TableName.Organization, (t) => {
|
await knex.schema.alterTable(TableName.Organization, (t) => {
|
||||||
t.boolean("secretShareSendToAnyone").defaultTo(true);
|
t.boolean("allowSecretSharingOutsideOrganization").defaultTo(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,10 +19,13 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
if (await knex.schema.hasTable(TableName.Organization)) {
|
if (await knex.schema.hasTable(TableName.Organization)) {
|
||||||
const hasSecretShareToAnyoneCol = await knex.schema.hasColumn(TableName.Organization, "secretShareSendToAnyone");
|
const hasSecretShareToAnyoneCol = await knex.schema.hasColumn(
|
||||||
|
TableName.Organization,
|
||||||
|
"allowSecretSharingOutsideOrganization"
|
||||||
|
);
|
||||||
if (hasSecretShareToAnyoneCol) {
|
if (hasSecretShareToAnyoneCol) {
|
||||||
await knex.schema.alterTable(TableName.Organization, (t) => {
|
await knex.schema.alterTable(TableName.Organization, (t) => {
|
||||||
t.dropColumn("secretShareSendToAnyone");
|
t.dropColumn("allowSecretSharingOutsideOrganization");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const OrganizationsSchema = z.object({
|
|||||||
defaultMembershipRole: z.string().default("member"),
|
defaultMembershipRole: z.string().default("member"),
|
||||||
enforceMfa: z.boolean().default(false),
|
enforceMfa: z.boolean().default(false),
|
||||||
selectedMfaMethod: z.string().nullable().optional(),
|
selectedMfaMethod: z.string().nullable().optional(),
|
||||||
secretShareSendToAnyone: z.boolean().default(true).nullable().optional()
|
allowSecretSharingOutsideOrganization: z.boolean().default(true).nullable().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TOrganizations = z.infer<typeof OrganizationsSchema>;
|
export type TOrganizations = z.infer<typeof OrganizationsSchema>;
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
defaultMembershipRoleSlug: slugSchema({ max: 64, field: "Default Membership Role" }).optional(),
|
defaultMembershipRoleSlug: slugSchema({ max: 64, field: "Default Membership Role" }).optional(),
|
||||||
enforceMfa: z.boolean().optional(),
|
enforceMfa: z.boolean().optional(),
|
||||||
selectedMfaMethod: z.nativeEnum(MfaMethod).optional(),
|
selectedMfaMethod: z.nativeEnum(MfaMethod).optional(),
|
||||||
secretShareSendToAnyone: z.boolean().optional()
|
allowSecretSharingOutsideOrganization: z.boolean().optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ import {
|
|||||||
import { TGroupDALFactory } from "@app/ee/services/group/group-dal";
|
import { TGroupDALFactory } from "@app/ee/services/group/group-dal";
|
||||||
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
||||||
import { TOidcConfigDALFactory } from "@app/ee/services/oidc/oidc-config-dal";
|
import { TOidcConfigDALFactory } from "@app/ee/services/oidc/oidc-config-dal";
|
||||||
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
|
import {
|
||||||
|
OrgPermissionActions,
|
||||||
|
OrgPermissionSecretShareAction,
|
||||||
|
OrgPermissionSubjects
|
||||||
|
} from "@app/ee/services/permission/org-permission";
|
||||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
|
||||||
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||||
import { TProjectUserAdditionalPrivilegeDALFactory } from "@app/ee/services/project-user-additional-privilege/project-user-additional-privilege-dal";
|
import { TProjectUserAdditionalPrivilegeDALFactory } from "@app/ee/services/project-user-additional-privilege/project-user-additional-privilege-dal";
|
||||||
@@ -294,13 +298,19 @@ export const orgServiceFactory = ({
|
|||||||
defaultMembershipRoleSlug,
|
defaultMembershipRoleSlug,
|
||||||
enforceMfa,
|
enforceMfa,
|
||||||
selectedMfaMethod,
|
selectedMfaMethod,
|
||||||
secretShareSendToAnyone
|
allowSecretSharingOutsideOrganization
|
||||||
}
|
}
|
||||||
}: TUpdateOrgDTO) => {
|
}: TUpdateOrgDTO) => {
|
||||||
const appCfg = getConfig();
|
const appCfg = getConfig();
|
||||||
const { permission } = await permissionService.getOrgPermission(actor, actorId, orgId, actorAuthMethod, actorOrgId);
|
const { permission } = await permissionService.getOrgPermission(actor, actorId, orgId, actorAuthMethod, actorOrgId);
|
||||||
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Edit, OrgPermissionSubjects.Settings);
|
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Edit, OrgPermissionSubjects.Settings);
|
||||||
|
|
||||||
|
if (allowSecretSharingOutsideOrganization !== undefined) {
|
||||||
|
ForbiddenError.from(permission).throwUnlessCan(
|
||||||
|
OrgPermissionSecretShareAction.ManageSettings,
|
||||||
|
OrgPermissionSubjects.SecretShare
|
||||||
|
);
|
||||||
|
}
|
||||||
const plan = await licenseService.getPlan(orgId);
|
const plan = await licenseService.getPlan(orgId);
|
||||||
const currentOrg = await orgDAL.findOrgById(actorOrgId);
|
const currentOrg = await orgDAL.findOrgById(actorOrgId);
|
||||||
|
|
||||||
@@ -368,7 +378,7 @@ export const orgServiceFactory = ({
|
|||||||
defaultMembershipRole,
|
defaultMembershipRole,
|
||||||
enforceMfa,
|
enforceMfa,
|
||||||
selectedMfaMethod,
|
selectedMfaMethod,
|
||||||
secretShareSendToAnyone
|
allowSecretSharingOutsideOrganization
|
||||||
});
|
});
|
||||||
if (!org) throw new NotFoundError({ message: `Organization with ID '${orgId}' not found` });
|
if (!org) throw new NotFoundError({ message: `Organization with ID '${orgId}' not found` });
|
||||||
return org;
|
return org;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export type TUpdateOrgDTO = {
|
|||||||
defaultMembershipRoleSlug: string;
|
defaultMembershipRoleSlug: string;
|
||||||
enforceMfa: boolean;
|
enforceMfa: boolean;
|
||||||
selectedMfaMethod: MfaMethod;
|
selectedMfaMethod: MfaMethod;
|
||||||
secretShareSendToAnyone: boolean;
|
allowSecretSharingOutsideOrganization: boolean;
|
||||||
}>;
|
}>;
|
||||||
} & TOrgPermission;
|
} & TOrgPermission;
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,13 @@ export const secretSharingServiceFactory = ({
|
|||||||
if (!permission) throw new ForbiddenRequestError({ name: "User is not a part of the specified organization" });
|
if (!permission) throw new ForbiddenRequestError({ name: "User is not a part of the specified organization" });
|
||||||
$validateSharedSecretExpiry(expiresAt);
|
$validateSharedSecretExpiry(expiresAt);
|
||||||
|
|
||||||
|
const org = await orgDAL.findOrgById(orgId);
|
||||||
|
if (!org.allowSecretSharingOutsideOrganization && accessType === SecretSharingAccessType.Anyone) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: "Organization does not allow sharing secrets to members outside of this organization"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (secretValue.length > 10_000) {
|
if (secretValue.length > 10_000) {
|
||||||
throw new BadRequestError({ message: "Shared secret value too long" });
|
throw new BadRequestError({ message: "Shared secret value too long" });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export const useUpdateOrg = () => {
|
|||||||
defaultMembershipRoleSlug,
|
defaultMembershipRoleSlug,
|
||||||
enforceMfa,
|
enforceMfa,
|
||||||
selectedMfaMethod,
|
selectedMfaMethod,
|
||||||
secretShareSendToAnyone
|
allowSecretSharingOutsideOrganization
|
||||||
}) => {
|
}) => {
|
||||||
return apiRequest.patch(`/api/v1/organization/${orgId}`, {
|
return apiRequest.patch(`/api/v1/organization/${orgId}`, {
|
||||||
name,
|
name,
|
||||||
@@ -120,7 +120,7 @@ export const useUpdateOrg = () => {
|
|||||||
defaultMembershipRoleSlug,
|
defaultMembershipRoleSlug,
|
||||||
enforceMfa,
|
enforceMfa,
|
||||||
selectedMfaMethod,
|
selectedMfaMethod,
|
||||||
secretShareSendToAnyone
|
allowSecretSharingOutsideOrganization
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export type Organization = {
|
|||||||
defaultMembershipRole: string;
|
defaultMembershipRole: string;
|
||||||
enforceMfa: boolean;
|
enforceMfa: boolean;
|
||||||
selectedMfaMethod?: MfaMethod;
|
selectedMfaMethod?: MfaMethod;
|
||||||
secretShareSendToAnyone?: boolean;
|
allowSecretSharingOutsideOrganization?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdateOrgDTO = {
|
export type UpdateOrgDTO = {
|
||||||
@@ -27,7 +27,7 @@ export type UpdateOrgDTO = {
|
|||||||
defaultMembershipRoleSlug?: string;
|
defaultMembershipRoleSlug?: string;
|
||||||
enforceMfa?: boolean;
|
enforceMfa?: boolean;
|
||||||
selectedMfaMethod?: MfaMethod;
|
selectedMfaMethod?: MfaMethod;
|
||||||
secretShareSendToAnyone?: boolean;
|
allowSecretSharingOutsideOrganization?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type BillingDetails = {
|
export type BillingDetails = {
|
||||||
|
|||||||
-2
@@ -101,8 +101,6 @@ export const RolePermissionsSection = ({ roleId }: Props) => {
|
|||||||
|
|
||||||
const onSubmit = async (el: TFormSchema) => {
|
const onSubmit = async (el: TFormSchema) => {
|
||||||
try {
|
try {
|
||||||
console.log(el.permissions);
|
|
||||||
console.log(formRolePermission2API(el.permissions));
|
|
||||||
await updateRole({
|
await updateRole({
|
||||||
orgId,
|
orgId,
|
||||||
id: roleId,
|
id: roleId,
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ export const SecretSharingAllowShareToAnyone = () => {
|
|||||||
|
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
orgId: currentOrg.id,
|
orgId: currentOrg.id,
|
||||||
secretShareSendToAnyone: value
|
allowSecretSharingOutsideOrganization: value
|
||||||
});
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -42,7 +42,7 @@ export const SecretSharingAllowShareToAnyone = () => {
|
|||||||
<Switch
|
<Switch
|
||||||
id="enable-secret-sharing-outside-org"
|
id="enable-secret-sharing-outside-org"
|
||||||
onCheckedChange={(value) => handleSecretSharingToggle(value)}
|
onCheckedChange={(value) => handleSecretSharingToggle(value)}
|
||||||
isChecked={currentOrg?.secretShareSendToAnyone ?? false}
|
isChecked={currentOrg?.allowSecretSharingOutsideOrganization ?? false}
|
||||||
isDisabled={!isAllowed}
|
isDisabled={!isAllowed}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ export const ShareSecretForm = ({ isPublic, value }: Props) => {
|
|||||||
onValueChange={(e) => onChange(e)}
|
onValueChange={(e) => onChange(e)}
|
||||||
className="w-full"
|
className="w-full"
|
||||||
>
|
>
|
||||||
{currentOrg?.secretShareSendToAnyone && (
|
{currentOrg?.allowSecretSharingOutsideOrganization && (
|
||||||
<SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
|
<SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
|
||||||
)}
|
)}
|
||||||
<SelectItem value={SecretSharingAccessType.Organization}>
|
<SelectItem value={SecretSharingAccessType.Organization}>
|
||||||
|
|||||||
Reference in New Issue
Block a user