mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix: resolved permission not defined for custom org role
This commit is contained in:
@@ -50,6 +50,7 @@ export const permissionDALFactory = (db: TDbClient) => {
|
||||
.select(
|
||||
selectAllTableCols(TableName.OrgMembership),
|
||||
db.ref("slug").withSchema(TableName.OrgRoles).withSchema(TableName.OrgRoles).as("customRoleSlug"),
|
||||
db.ref("permissions").withSchema(TableName.OrgRoles),
|
||||
db.ref("authEnforced").withSchema(TableName.Organization).as("orgAuthEnforced"),
|
||||
db.ref("groupId").withSchema("userGroups"),
|
||||
db.ref("groupOrgId").withSchema("userGroups"),
|
||||
|
||||
@@ -10,9 +10,10 @@ export const kmsKeys = {
|
||||
getActiveProjectKms: (projectId: string) => ["get-active-project-kms", { projectId }]
|
||||
};
|
||||
|
||||
export const useGetExternalKmsList = (orgId: string) => {
|
||||
export const useGetExternalKmsList = (orgId: string, { enabled }: { enabled?: boolean } = {}) => {
|
||||
return useQuery({
|
||||
queryKey: kmsKeys.getExternalKmsList(orgId),
|
||||
enabled,
|
||||
queryFn: async () => {
|
||||
const {
|
||||
data: { externalKmsList }
|
||||
|
||||
@@ -59,6 +59,7 @@ import {
|
||||
OrgPermissionActions,
|
||||
OrgPermissionSubjects,
|
||||
useOrganization,
|
||||
useOrgPermission,
|
||||
useSubscription,
|
||||
useUser,
|
||||
useWorkspace
|
||||
@@ -153,7 +154,11 @@ export const AppLayout = ({ children }: LayoutProps) => {
|
||||
|
||||
const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({ workspaceId });
|
||||
const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({ projectSlug });
|
||||
const { data: externalKmsList } = useGetExternalKmsList(currentOrg?.id!);
|
||||
const { permission } = useOrgPermission();
|
||||
console.log(permission.can(OrgPermissionActions.Read, OrgPermissionSubjects.Kms));
|
||||
const { data: externalKmsList } = useGetExternalKmsList(currentOrg?.id!, {
|
||||
enabled: permission.can(OrgPermissionActions.Read, OrgPermissionSubjects.Kms)
|
||||
});
|
||||
|
||||
const pendingRequestsCount = useMemo(() => {
|
||||
return (secretApprovalReqCount?.open || 0) + (accessApprovalRequestCount?.pendingCount || 0);
|
||||
|
||||
@@ -56,6 +56,7 @@ import {
|
||||
OrgPermissionActions,
|
||||
OrgPermissionSubjects,
|
||||
useOrganization,
|
||||
useOrgPermission,
|
||||
useSubscription,
|
||||
useUser,
|
||||
useWorkspace
|
||||
@@ -494,6 +495,7 @@ const OrganizationPage = () => {
|
||||
|
||||
const { workspaces, isLoading: isWorkspaceLoading } = useWorkspace();
|
||||
const { currentOrg } = useOrganization();
|
||||
const { permission } = useOrgPermission();
|
||||
const routerOrgId = String(router.query.id);
|
||||
const orgWorkspaces = workspaces?.filter((workspace) => workspace.orgId === routerOrgId) || [];
|
||||
const { data: projectFavorites, isLoading: isProjectFavoritesLoading } =
|
||||
@@ -531,7 +533,9 @@ const OrganizationPage = () => {
|
||||
(localStorage.getItem("projectsViewMode") as ProjectsViewMode) || ProjectsViewMode.GRID
|
||||
);
|
||||
|
||||
const { data: externalKmsList } = useGetExternalKmsList(currentOrg?.id!);
|
||||
const { data: externalKmsList } = useGetExternalKmsList(currentOrg?.id!, {
|
||||
enabled: permission.can(OrgPermissionActions.Read, OrgPermissionSubjects.Kms)
|
||||
});
|
||||
|
||||
const onCreateProject = async ({ name, addMembers, kmsKeyId }: TAddProjectFormData) => {
|
||||
// type check
|
||||
|
||||
Reference in New Issue
Block a user