From f5fa39b97e2ca37cfcd4e4b8f93119810a4d5dae Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Mon, 9 Feb 2026 01:15:35 -0600 Subject: [PATCH] refactor(dokploy): restrict license key access to owners only and enhance validation - Updated the license key settings to ensure only users with the "owner" role can access certain functionalities. - Modified the license key activation input validation to require a non-empty string. - Improved error handling for network issues when validating license keys, providing clearer feedback to users. - Adjusted the dashboard settings to redirect non-owner users appropriately. --- apps/dokploy/components/layouts/side.tsx | 3 +-- .../proprietary/license-keys/license-key.tsx | 7 +++++- .../pages/dashboard/settings/license.tsx | 4 ++-- .../api/routers/proprietary/license-key.ts | 23 ++++++++++++++++++- apps/dokploy/server/utils/enterprise.ts | 22 ++++++++++++++++++ 5 files changed, 53 insertions(+), 6 deletions(-) diff --git a/apps/dokploy/components/layouts/side.tsx b/apps/dokploy/components/layouts/side.tsx index 0062c223a..52f8b5bfb 100644 --- a/apps/dokploy/components/layouts/side.tsx +++ b/apps/dokploy/components/layouts/side.tsx @@ -404,8 +404,7 @@ const MENU: Menu = { url: "/dashboard/settings/license", icon: Key, // Only enabled for admins in non-cloud environments - isEnabled: ({ auth }) => - !!(auth?.role === "owner" || auth?.role === "admin"), + isEnabled: ({ auth }) => !!(auth?.role === "owner"), }, { isSingle: true, diff --git a/apps/dokploy/components/proprietary/license-keys/license-key.tsx b/apps/dokploy/components/proprietary/license-keys/license-key.tsx index 89e429ebd..a1b29c6cd 100644 --- a/apps/dokploy/components/proprietary/license-keys/license-key.tsx +++ b/apps/dokploy/components/proprietary/license-keys/license-key.tsx @@ -166,7 +166,12 @@ export function LicenseKeySettings() { {!haveValidLicenseKey && (