-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed: job assignee can remove or update any issue created by the tas… #4436
Conversation
cvat/apps/iam/rules/issues.rego
Outdated
@@ -222,6 +222,7 @@ allow { | |||
utils.is_sandbox | |||
utils.has_perm(utils.WORKER) | |||
is_issue_admin | |||
not is_job_assignee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will recommend to change is_issue_admin
definition. Let's replace job_staff to task_staff. Thus you don't need the new condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nmanovic , Good idea. much better.
However, after modifying the definition of is_issue_admin
, the following error occurred as a result of the rule test.
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_BUSINESS_membership_NONE_same_org_TRUE_has_proj_TRUE: FAIL (334.385μs)
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_BUSINESS_membership_NONE_same_org_TRUE_has_proj_FALSE: FAIL (326.482μs)
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_USER_membership_NONE_same_org_TRUE_has_proj_TRUE: FAIL (331.52μs)
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_USER_membership_NONE_same_org_TRUE_has_proj_FALSE: FAIL (324.097μs)
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_NONE_same_org_TRUE_has_proj_TRUE: FAIL (331.857μs)
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_NONE_same_org_TRUE_has_proj_FALSE: FAIL (319.203μs)
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_NONE_membership_NONE_same_org_TRUE_has_proj_TRUE: FAIL (332.902μs)
data.issues.test_scope_VIEW_context_SANDBOX_ownership_JOB_ASSIGNEE_privilege_NONE_membership_NONE_same_org_TRUE_has_proj_FALSE: FAIL (315.895μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_BUSINESS_membership_SUPERVISOR_same_org_TRUE_has_proj_TRUE: FAIL (490.933μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_BUSINESS_membership_SUPERVISOR_same_org_TRUE_has_proj_FALSE: FAIL (486.365μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_BUSINESS_membership_WORKER_same_org_TRUE_has_proj_TRUE: FAIL (481.226μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_BUSINESS_membership_WORKER_same_org_TRUE_has_proj_FALSE: FAIL (486.961μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_USER_membership_SUPERVISOR_same_org_TRUE_has_proj_TRUE: FAIL (458.056μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_USER_membership_SUPERVISOR_same_org_TRUE_has_proj_FALSE: FAIL (456.854μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_USER_membership_WORKER_same_org_TRUE_has_proj_TRUE: FAIL (468.752μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_USER_membership_WORKER_same_org_TRUE_has_proj_FALSE: FAIL (467.93μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_OWNER_same_org_TRUE_has_proj_TRUE: FAIL (415.898μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_OWNER_same_org_TRUE_has_proj_FALSE: FAIL (421.486μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_MAINTAINER_same_org_TRUE_has_proj_TRUE: FAIL (409.93μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_MAINTAINER_same_org_TRUE_has_proj_FALSE: FAIL (420.387μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_SUPERVISOR_same_org_TRUE_has_proj_TRUE: FAIL (414.979μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_SUPERVISOR_same_org_TRUE_has_proj_FALSE: FAIL (411.665μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_WORKER_same_org_TRUE_has_proj_TRUE: FAIL (402.816μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_WORKER_membership_WORKER_same_org_TRUE_has_proj_FALSE: FAIL (401.203μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_OWNER_same_org_TRUE_has_proj_TRUE: FAIL (373.611μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_OWNER_same_org_TRUE_has_proj_FALSE: FAIL (387.152μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_MAINTAINER_same_org_TRUE_has_proj_TRUE: FAIL (376.263μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_MAINTAINER_same_org_TRUE_has_proj_FALSE: FAIL (372.317μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_SUPERVISOR_same_org_TRUE_has_proj_TRUE: FAIL (379.072μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_SUPERVISOR_same_org_TRUE_has_proj_FALSE: FAIL (366.83μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_WORKER_same_org_TRUE_has_proj_TRUE: FAIL (416.041μs)
data.issues.test_scope_VIEW_context_ORGANIZATION_ownership_JOB_ASSIGNEE_privilege_NONE_membership_WORKER_same_org_TRUE_has_proj_FALSE: FAIL (365.501μs)
--------------------------------------------------------------------------------
PASS: 2828/2860
FAIL: 32/2860
Thus I added one more is_issue_staff
condition, and as a result, the rule test passed. Would be ok?
is_issue_staff {
is_job_staff
}
$ opa test issues_test.gen.rego issues.rego utils.rego organizations.rego
PASS: 2860/2860
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k1won , thanks for all your time!
…k owner #4424
Motivation and context
Resolves #4424
How has this been tested?
Manual test
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.