mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: fix isAcessible query join/filter and clear sub org query cache when org changes
This commit is contained in:
@@ -172,14 +172,16 @@ export const orgDALFactory = (db: TDbClient) => {
|
||||
.select(selectAllTableCols(TableName.Organization));
|
||||
|
||||
if (dto.isAccessible) {
|
||||
void query.leftJoin(`${TableName.Membership}`, (qb) => {
|
||||
void qb.on(`${TableName.Membership}.scope`, AccessScope.Organization);
|
||||
if (dto.actorType === ActorType.IDENTITY) {
|
||||
void qb.andOn(`${TableName.Membership}.actorIdentityId`, dto.actorId);
|
||||
} else {
|
||||
void qb.andOn(`${TableName.Membership}.actorUserId`, dto.actorId);
|
||||
}
|
||||
});
|
||||
void query
|
||||
.leftJoin(`${TableName.Membership}`, `${TableName.Membership}.scopeOrgId`, `${TableName.Organization}.id`)
|
||||
.where((qb) => {
|
||||
void qb.where(`${TableName.Membership}.scope`, AccessScope.Organization);
|
||||
if (dto.actorType === ActorType.IDENTITY) {
|
||||
void qb.andWhere(`${TableName.Membership}.actorIdentityId`, dto.actorId);
|
||||
} else {
|
||||
void qb.andWhere(`${TableName.Membership}.actorUserId`, dto.actorId);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (dto.limit) void query.limit(dto.limit);
|
||||
if (dto.offset) void query.offset(dto.offset);
|
||||
|
||||
@@ -134,13 +134,13 @@ export const Navbar = () => {
|
||||
const { subscription } = useSubscription();
|
||||
const { currentOrg, isSubOrganization } = useOrganization();
|
||||
|
||||
console.log("current", currentOrg, isSubOrganization);
|
||||
|
||||
const [showAdminsModal, setShowAdminsModal] = useState(false);
|
||||
const [showSubOrgForm, setShowSubOrgForm] = useState(false);
|
||||
const [showCardDeclinedModal, setShowCardDeclinedModal] = useState(false);
|
||||
|
||||
const subOrgQuery = subOrganizationsQuery.list({ limit: 500, isAccessible: true });
|
||||
const { data: subOrganizations = [] } = useQuery({
|
||||
...subOrganizationsQuery.list({ limit: 500, isAccessible: true }),
|
||||
...subOrgQuery,
|
||||
enabled: Boolean(subscription.subOrganization)
|
||||
});
|
||||
|
||||
@@ -183,6 +183,7 @@ export const Navbar = () => {
|
||||
}
|
||||
await router.invalidate();
|
||||
await navigateUserToOrg(navigate, orgId);
|
||||
queryClient.removeQueries({ queryKey: subOrgQuery.queryKey });
|
||||
};
|
||||
|
||||
const { mutateAsync } = useGetOrgTrialUrl();
|
||||
|
||||
@@ -7,7 +7,7 @@ import { z } from "zod";
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
import { Button, FormControl, Input } from "@app/components/v2";
|
||||
import { useCreateSubOrganization } from "@app/hooks/api";
|
||||
import { GenericResourceNameSchema, slugSchema } from "@app/lib/schemas";
|
||||
import { slugSchema } from "@app/lib/schemas";
|
||||
|
||||
type ContentProps = {
|
||||
onClose: () => void;
|
||||
|
||||
Reference in New Issue
Block a user