mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 22:55:24 +00:00
feat: folder logins for shared hosts, read only plugin sync, full desktop builds
This commit is contained in:
1 parent
b32203d19b
commit
a0e13f9eeb
33 files changed
+15245
-14
No files matched your search
@@ -4,6 +4,7 @@ import {
|
||||
createCurrentHostResolutionRepository,
|
||||
createCurrentRbacAccessRepository,
|
||||
createCurrentRoleRepository,
|
||||
createCurrentSharedFolderAuthOverrideRepository,
|
||||
createCurrentSharedHostAuthOverrideRepository,
|
||||
} from "../database/repositories/factory.js";
|
||||
import type {
|
||||
@@ -23,6 +24,8 @@ export type RecipientSharedHostAuthResolution =
|
||||
source: "personal-override";
|
||||
credentialId: number;
|
||||
credential: HostResolutionCredentialRecord;
|
||||
/** Set when the login comes from the folder, not the host itself. */
|
||||
folder?: string;
|
||||
}
|
||||
| {
|
||||
source: "owner-shared";
|
||||
@@ -54,8 +57,8 @@ function isOwnerAuthShared(
|
||||
|
||||
/**
|
||||
* Applies the shared-host authentication precedence independently from any
|
||||
* transport: recipient override, shared owner auth, secretless auth, then
|
||||
* "required".
|
||||
* transport: recipient override on the host, then on its folder, shared
|
||||
* owner auth, secretless auth, then "required".
|
||||
*/
|
||||
export async function resolveRecipientSharedHostAuthentication(
|
||||
host: HostResolutionHostRecord,
|
||||
@@ -91,6 +94,31 @@ export async function resolveRecipientSharedHostAuthentication(
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const folderOverride =
|
||||
await createCurrentSharedFolderAuthOverrideRepository().findClosest(
|
||||
userId,
|
||||
host.folder,
|
||||
protocol,
|
||||
);
|
||||
if (folderOverride) {
|
||||
const credential = await findUsableCredential(
|
||||
folderOverride.credentialId,
|
||||
userId,
|
||||
);
|
||||
if (credential) {
|
||||
return {
|
||||
source: "personal-override",
|
||||
credentialId: folderOverride.credentialId,
|
||||
credential,
|
||||
folder: folderOverride.folder,
|
||||
};
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Same as a host override: an unreadable one counts as none.
|
||||
}
|
||||
|
||||
if (isOwnerAuthShared(host, protocol)) {
|
||||
if (protocol === "ssh" && host.authType === "agent") {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user