Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions admin/server/runtime_jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,16 @@ func (s *Server) issueRuntimeToken(ctx context.Context, opts *issueRuntimeTokenO
}
}

// Check if allowed to manage the deployment's environment.
// Check if allowed to manage the deployment's environment, or to read its status.
// NOTE: Only applicable for tokens issued for the claims owner (not possible to delegate to other end users).
var manageDepl bool
var manageDepl, readDeplStatus bool
if opts.forOwner {
if opts.deployment.Environment == "prod" {
manageDepl = opts.projectPermissions.ManageProd
readDeplStatus = opts.projectPermissions.ReadProdStatus
} else {
manageDepl = opts.projectPermissions.ManageDev
readDeplStatus = opts.projectPermissions.ReadDevStatus
}
}

Expand All @@ -191,6 +193,10 @@ func (s *Server) issueRuntimeToken(ctx context.Context, opts *issueRuntimeTokenO
runtime.ReadObjects,
runtime.UseAI,
}
if readDeplStatus {
// Status visibility: lets non-managers (e.g. editors) view the project Status page.
instancePermissions = append(instancePermissions, runtime.ReadInstance)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite sufficient; it needs some extra checks, and also needs to update some permission checks on the runtime side. Implemented the correct checks here: #9372

}
if manageDepl {
instancePermissions = append(
instancePermissions,
Expand Down
2 changes: 1 addition & 1 deletion web-admin/src/features/projects/ProjectTabs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{
route: `/${organization}/${project}${branchPrefix}/-/status`,
label: "Status",
hasPermission: projectPermissions.manageProject,
hasPermission: projectPermissions.readProdStatus,
},
{
route: `/${organization}/${project}${branchPrefix}/-/settings`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { redirect } from "@sveltejs/kit";

export const load = async ({ parent, params: { organization, project } }) => {
const { projectPermissions } = await parent();
if (!projectPermissions?.manageProject) {
if (!projectPermissions?.readProdStatus) {
throw redirect(307, `/${organization}/${project}`);
}
};
Loading