mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fix rebase issue with deleted files
This commit is contained in:
@@ -4,11 +4,14 @@ import { TableName } from "../schemas";
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
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) {
|
||||
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> {
|
||||
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) {
|
||||
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"),
|
||||
enforceMfa: z.boolean().default(false),
|
||||
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>;
|
||||
|
||||
@@ -258,7 +258,7 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
defaultMembershipRoleSlug: slugSchema({ max: 64, field: "Default Membership Role" }).optional(),
|
||||
enforceMfa: z.boolean().optional(),
|
||||
selectedMfaMethod: z.nativeEnum(MfaMethod).optional(),
|
||||
secretShareSendToAnyone: z.boolean().optional()
|
||||
allowSecretSharingOutsideOrganization: z.boolean().optional()
|
||||
}),
|
||||
response: {
|
||||
200: z.object({
|
||||
|
||||
@@ -19,7 +19,11 @@ import {
|
||||
import { TGroupDALFactory } from "@app/ee/services/group/group-dal";
|
||||
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
||||
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 { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
|
||||
import { TProjectUserAdditionalPrivilegeDALFactory } from "@app/ee/services/project-user-additional-privilege/project-user-additional-privilege-dal";
|
||||
@@ -294,13 +298,19 @@ export const orgServiceFactory = ({
|
||||
defaultMembershipRoleSlug,
|
||||
enforceMfa,
|
||||
selectedMfaMethod,
|
||||
secretShareSendToAnyone
|
||||
allowSecretSharingOutsideOrganization
|
||||
}
|
||||
}: TUpdateOrgDTO) => {
|
||||
const appCfg = getConfig();
|
||||
const { permission } = await permissionService.getOrgPermission(actor, actorId, orgId, actorAuthMethod, actorOrgId);
|
||||
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 currentOrg = await orgDAL.findOrgById(actorOrgId);
|
||||
|
||||
@@ -368,7 +378,7 @@ export const orgServiceFactory = ({
|
||||
defaultMembershipRole,
|
||||
enforceMfa,
|
||||
selectedMfaMethod,
|
||||
secretShareSendToAnyone
|
||||
allowSecretSharingOutsideOrganization
|
||||
});
|
||||
if (!org) throw new NotFoundError({ message: `Organization with ID '${orgId}' not found` });
|
||||
return org;
|
||||
|
||||
@@ -72,7 +72,7 @@ export type TUpdateOrgDTO = {
|
||||
defaultMembershipRoleSlug: string;
|
||||
enforceMfa: boolean;
|
||||
selectedMfaMethod: MfaMethod;
|
||||
secretShareSendToAnyone: boolean;
|
||||
allowSecretSharingOutsideOrganization: boolean;
|
||||
}>;
|
||||
} & TOrgPermission;
|
||||
|
||||
|
||||
@@ -82,6 +82,13 @@ export const secretSharingServiceFactory = ({
|
||||
if (!permission) throw new ForbiddenRequestError({ name: "User is not a part of the specified organization" });
|
||||
$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) {
|
||||
throw new BadRequestError({ message: "Shared secret value too long" });
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export const useUpdateOrg = () => {
|
||||
defaultMembershipRoleSlug,
|
||||
enforceMfa,
|
||||
selectedMfaMethod,
|
||||
secretShareSendToAnyone
|
||||
allowSecretSharingOutsideOrganization
|
||||
}) => {
|
||||
return apiRequest.patch(`/api/v1/organization/${orgId}`, {
|
||||
name,
|
||||
@@ -120,7 +120,7 @@ export const useUpdateOrg = () => {
|
||||
defaultMembershipRoleSlug,
|
||||
enforceMfa,
|
||||
selectedMfaMethod,
|
||||
secretShareSendToAnyone
|
||||
allowSecretSharingOutsideOrganization
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
|
||||
@@ -15,7 +15,7 @@ export type Organization = {
|
||||
defaultMembershipRole: string;
|
||||
enforceMfa: boolean;
|
||||
selectedMfaMethod?: MfaMethod;
|
||||
secretShareSendToAnyone?: boolean;
|
||||
allowSecretSharingOutsideOrganization?: boolean;
|
||||
};
|
||||
|
||||
export type UpdateOrgDTO = {
|
||||
@@ -27,7 +27,7 @@ export type UpdateOrgDTO = {
|
||||
defaultMembershipRoleSlug?: string;
|
||||
enforceMfa?: boolean;
|
||||
selectedMfaMethod?: MfaMethod;
|
||||
secretShareSendToAnyone?: boolean;
|
||||
allowSecretSharingOutsideOrganization?: boolean;
|
||||
};
|
||||
|
||||
export type BillingDetails = {
|
||||
|
||||
@@ -101,8 +101,6 @@ export const RolePermissionsSection = ({ roleId }: Props) => {
|
||||
|
||||
const onSubmit = async (el: TFormSchema) => {
|
||||
try {
|
||||
console.log(el.permissions);
|
||||
console.log(formRolePermission2API(el.permissions));
|
||||
await updateRole({
|
||||
orgId,
|
||||
id: roleId,
|
||||
|
||||
@@ -14,7 +14,7 @@ export const SecretSharingAllowShareToAnyone = () => {
|
||||
|
||||
await mutateAsync({
|
||||
orgId: currentOrg.id,
|
||||
secretShareSendToAnyone: value
|
||||
allowSecretSharingOutsideOrganization: value
|
||||
});
|
||||
|
||||
createNotification({
|
||||
@@ -42,7 +42,7 @@ export const SecretSharingAllowShareToAnyone = () => {
|
||||
<Switch
|
||||
id="enable-secret-sharing-outside-org"
|
||||
onCheckedChange={(value) => handleSecretSharingToggle(value)}
|
||||
isChecked={currentOrg?.secretShareSendToAnyone ?? false}
|
||||
isChecked={currentOrg?.allowSecretSharingOutsideOrganization ?? false}
|
||||
isDisabled={!isAllowed}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -232,7 +232,7 @@ export const ShareSecretForm = ({ isPublic, value }: Props) => {
|
||||
onValueChange={(e) => onChange(e)}
|
||||
className="w-full"
|
||||
>
|
||||
{currentOrg?.secretShareSendToAnyone && (
|
||||
{currentOrg?.allowSecretSharingOutsideOrganization && (
|
||||
<SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
|
||||
)}
|
||||
<SelectItem value={SecretSharingAccessType.Organization}>
|
||||
|
||||
Reference in New Issue
Block a user