diff --git a/changes/19055-hide-run-script b/changes/19055-hide-run-script
new file mode 100644
index 0000000000..b45a211ea2
--- /dev/null
+++ b/changes/19055-hide-run-script
@@ -0,0 +1 @@
+* Hide the host detail page's "Run script" action from Global and Team Observer/+s.
diff --git a/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/HostActionsDropdown.tests.tsx b/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/HostActionsDropdown.tests.tsx
index 8ec9181d04..51beb650fe 100644
--- a/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/HostActionsDropdown.tests.tsx
+++ b/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/HostActionsDropdown.tests.tsx
@@ -1135,6 +1135,60 @@ describe("Host Actions Dropdown", () => {
await user.click(screen.getByText("Actions"));
+ expect(screen.queryByText("Run script")).not.toBeInTheDocument();
+ });
+ it("does not render the Run script action for global observers/+", async () => {
+ // Global observer
+ const render = createCustomRenderer({
+ context: {
+ app: {
+ isGlobalObserver: true,
+ currentUser: createMockUser(),
+ },
+ },
+ });
+ const { user } = render(
+
+ );
+
+ await user.click(screen.getByText("Actions"));
+
+ expect(screen.queryByText("Run script")).not.toBeInTheDocument();
+ });
+ it("does not render the Run script action for team observers/+", async () => {
+ // team observer
+ const render = createCustomRenderer({
+ context: {
+ app: {
+ isTeamObserver: true,
+ currentUser: createMockUser(),
+ },
+ },
+ });
+ const { user } = render(
+
+ );
+
+ await user.click(screen.getByText("Actions"));
+
expect(screen.queryByText("Run script")).not.toBeInTheDocument();
});
});
diff --git a/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx b/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx
index 8f35c89a72..3665687d03 100644
--- a/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx
+++ b/frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx
@@ -226,18 +226,11 @@ const canRunScript = ({
hostPlatform,
isGlobalAdmin,
isGlobalMaintainer,
- isGlobalObserver,
isTeamAdmin,
isTeamMaintainer,
- isTeamObserver,
}: IHostActionConfigOptions) => {
return (
- (isGlobalAdmin ||
- isGlobalMaintainer ||
- isGlobalObserver ||
- isTeamAdmin ||
- isTeamMaintainer ||
- isTeamObserver) &&
+ (isGlobalAdmin || isGlobalMaintainer || isTeamAdmin || isTeamMaintainer) &&
isScriptSupportedPlatform(hostPlatform)
);
};