Repository navigation
fix(site): gate template routes and actions by permissions - #31948
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6098035002
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Documentation CheckBlocking
Findings for agents- id: learner-1
persona: learner
class: missing
blocking: true
file: docs/templates/creating-templates.md
line: 5
quote: "Users with the `Template Administrator` role or above can create templates within Coder."
evidence:
- site/src/pages/CreateTemplatePage/CreateTemplatePage.tsx:88
- site/src/modules/permissions/templates.ts:10
rule: null
problem: Create-template routes are now gated on the createTemplates permission and show a permission dialog for users without it, but the page names only the coarse "Template Administrator role or above" (which is "Template Admin") and never explains the createTemplates permission or the dialog.
fix: State that creating a template requires the createTemplates permission, granted by the Template Admin role or individually via RBAC, and that users without it see "You don't have permission to view this page". Use "Template Admin", not "Template Administrator".
verified: true
- id: learner-4
persona: learner
class: missing
blocking: true
file: docs/templates/creating-templates.md
line: 149
quote: "Give the new template a name, icon, and description."
evidence:
- site/src/pages/CreateTemplatePage/DuplicateTemplateView.tsx:107
- site/src/pages/CreateTemplatePage/DuplicateTemplateView.tsx:120
rule: null
problem: Duplicating a template now supports cross-organization duplication (the copy can target a different organization than the source, via an organization selector), and Duplicate requires template update permission plus the permission to create templates. The duplicate steps list only name, icon, and description and never mention the destination organization or the required permissions.
fix: In the "From an existing template" Web UI steps, note that the duplication form includes an organization selector for the copy's destination (which can differ from the source) when organizations are enabled, and that Duplicate requires template update permission plus the permission to create templates.
verified: trueAutomated review via Coder Agents. Reply to a finding's thread with the reason if the finding is wrong. |
Template pages could be opened directly without the permissions their forms and API requests require, leading to rejected requests or endless loaders. Gate the routes and restricted queries before mounting editor controls, while preserving version metadata and read-only parameters for template readers.
/templates/new/templates/new?exampleId=<starter-id>/templates/new?fromTemplate=<template-id>/templates/new/builderand?base=<base-id>/templates/new./starter-templates/starter-templates/<starter-id>/templates/<template>/settings/templates/<template>/settings/variables/templates/<template>/settings/schedule/templates/<template>/settings/permissions/templates/<template>/settings/parameters/templates/<template>/files/templates/<template>/prebuilds/templates/<template>/versions/<version>/templates/<template>/versions/<version>/editTemplate-specific routes also support
/templates/<organization>/<template>/….The template menu checks update, create, and delete separately: Duplicate requires source update and destination creation capability, while Delete uses resource-scoped deletion permission. Template browsing, the starter gallery, and the builder determine builder availability without fetching admin-only deployment configuration. Background query errors preserve loaded forms and editor content.
Validated with 76 affected unit tests, 15 browser story tests, Storybook visual inspection,
pnpm format,pnpm check,pnpm lint, and the frontend self-reviews.