Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: adjust assignee and rollout permissions (#8486)
Liu Ji4eeb6a1d17e2
diff --git a/frontend/src/components/IssueV1/logic/action/task.ts b/frontend/src/components/IssueV1/logic/action/task.tsindex 37bb69fc58..e563fc90e1 100644--- a/frontend/src/components/IssueV1/logic/action/task.ts+++ b/frontend/src/components/IssueV1/logic/action/task.ts@@ -4,7 +4,7 @@ import { ComposedIssue } from "@/types";import { User } from "@/types/proto/v1/auth_service";import { IssueStatus } from "@/types/proto/v1/issue_service";import { Task, Task_Status, Task_Type } from "@/types/proto/v1/rollout_service";-import { extractUserResourceName } from "@/utils";+import { extractUserResourceName, hasWorkspacePermissionV1 } from "@/utils";import {allowUserToBeAssignee,getCurrentRolloutPolicyForTask,@@ -139,6 +139,18 @@ export const allowUserToApplyTaskRolloutAction = async (const project = issue.projectEntity;const rolloutPolicy = await getCurrentRolloutPolicyForTask(issue, task);+ if (+ hasWorkspacePermissionV1(+ "bb.permission.workspace.manage-issue",+ user.userRole+ )+ ) {+ // Super users are always allowed to rollout issues.+ return true;+ }++ // Otherwise anyone might to be assignee can rollout the issue.+ // if the rollout policy is "auto rollout", anyone in the project is allowed.if (allowUserToBeAssignee(user,diff --git a/frontend/src/components/IssueV1/logic/assignee.ts b/frontend/src/components/IssueV1/logic/assignee.tsindex 0a9c776aaf..38d6d49694 100644--- a/frontend/src/components/IssueV1/logic/assignee.ts+++ b/frontend/src/components/IssueV1/logic/assignee.ts@@ -11,7 +11,6 @@ import {emptyStage,emptyTask,MaybeRef,- SYSTEM_BOT_EMAIL,unknownEnvironment,} from "@/types";import { User } from "@/types/proto/v1/auth_service";@@ -201,16 +200,30 @@ export const allowUserToChangeAssignee = (user: User, issue: ComposedIssue) => {user.userRole)) {+ // Super users are always allowed to change the assignee+ return true;+ }++ if (isOwnerOfProjectV1(issue.projectEntity.iamPolicy, user)) {+ // The project owner can change the assigneereturn true;}const currentUserEmail = user.email;- const assigneeEmail = extractUserResourceName(issue.assignee);+const creatorEmail = extractUserResourceName(issue.creator);- if (assigneeEmail === SYSTEM_BOT_EMAIL) {- return currentUserEmail === creatorEmail;+ if (currentUserEmail === creatorEmail) {+ // The creator of the issue can change the assignee.+ return true;}- return currentUserEmail === assigneeEmail;++ const assigneeEmail = extractUserResourceName(issue.assignee);+ if (currentUserEmail === assigneeEmail) {+ // The current assignee can re-assignee (forward) to another assignee.+ return true;+ }++ return false;};export const allowProjectOwnerToApprove = (