mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-15 16:35:17 +00:00
Merge pull request #4168 from Dokploy/fix/ssh-key-member-access
fix: allow members to use SSH keys for deployments without full access
This commit is contained in:
@@ -55,7 +55,7 @@ interface Props {
|
|||||||
|
|
||||||
export const SaveGitProvider = ({ applicationId }: Props) => {
|
export const SaveGitProvider = ({ applicationId }: Props) => {
|
||||||
const { data, refetch } = api.application.one.useQuery({ applicationId });
|
const { data, refetch } = api.application.one.useQuery({ applicationId });
|
||||||
const { data: sshKeys } = api.sshKey.all.useQuery();
|
const { data: sshKeys } = api.sshKey.allForApps.useQuery();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const { mutateAsync, isPending } =
|
const { mutateAsync, isPending } =
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ interface Props {
|
|||||||
|
|
||||||
export const SaveGitProviderCompose = ({ composeId }: Props) => {
|
export const SaveGitProviderCompose = ({ composeId }: Props) => {
|
||||||
const { data, refetch } = api.compose.one.useQuery({ composeId });
|
const { data, refetch } = api.compose.one.useQuery({ composeId });
|
||||||
const { data: sshKeys } = api.sshKey.all.useQuery();
|
const { data: sshKeys } = api.sshKey.allForApps.useQuery();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const { mutateAsync, isPending } = api.compose.update.useMutation();
|
const { mutateAsync, isPending } = api.compose.update.useMutation();
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ import {
|
|||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
import { desc, eq } from "drizzle-orm";
|
import { desc, eq } from "drizzle-orm";
|
||||||
import { createTRPCRouter, withPermission } from "@/server/api/trpc";
|
import {
|
||||||
|
createTRPCRouter,
|
||||||
|
protectedProcedure,
|
||||||
|
withPermission,
|
||||||
|
} from "@/server/api/trpc";
|
||||||
import { audit } from "@/server/api/utils/audit";
|
import { audit } from "@/server/api/utils/audit";
|
||||||
import {
|
import {
|
||||||
apiCreateSshKey,
|
apiCreateSshKey,
|
||||||
@@ -83,6 +87,16 @@ export const sshRouter = createTRPCRouter({
|
|||||||
orderBy: desc(sshKeys.createdAt),
|
orderBy: desc(sshKeys.createdAt),
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
allForApps: protectedProcedure.query(async ({ ctx }) => {
|
||||||
|
return await db.query.sshKeys.findMany({
|
||||||
|
columns: {
|
||||||
|
sshKeyId: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
where: eq(sshKeys.organizationId, ctx.session.activeOrganizationId),
|
||||||
|
orderBy: desc(sshKeys.createdAt),
|
||||||
|
});
|
||||||
|
}),
|
||||||
generate: withPermission("sshKeys", "read")
|
generate: withPermission("sshKeys", "read")
|
||||||
.input(apiGenerateSSHKey)
|
.input(apiGenerateSSHKey)
|
||||||
.mutation(async ({ input }) => {
|
.mutation(async ({ input }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user