Add Object permissions to project and allow set add_check globally or per-project#653
Add Object permissions to project and allow set add_check globally or per-project#653mchehab wants to merge 5 commits into
Conversation
|
@mchehab Could you propose these against the |
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
b99ac5a to
054de50
Compare
|
Thanks for changing the baseline. My user were unable to change the baseline indication at the PR. |
|
hmm... this one requires more work... it actually added "add |
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
|
I changed this one to RFC, as some work is still needed to be able to have per-project permissions. |
|
Tests with https://github.com/mchehab/pw_tools: User without global "add_check" permission: After granting After removing After granding In summary, both coarse grained and fine grained |
matttbe
left a comment
There was a problem hiding this comment.
Thank you for looking at this! I have a couple of questions/ suggestions of you don't mind.
| # Notice that this is a global permission: it allows | ||
| # adding checks to any project inside Patchwork. | ||
| if user.has_perm('patchwork.add_check'): | ||
| patch._edited_by = user |
There was a problem hiding this comment.
(patch is not defined in this first commit)
There was a problem hiding this comment.
I'll fix on a next rebase (I'm currently in vacations - will likely do it next weekend).
| django-filter~=25.2.0 | ||
| django-debug-toolbar~=6.3.0 | ||
| django-dbbackup~=5.3.0 | ||
| django-guardian~=3.3.1 |
There was a problem hiding this comment.
Could you move it to the test one, please? I guess that's why the CI is no longer passing
There was a problem hiding this comment.
ok, will do at the next rebase.
| patch._edited_by = user | ||
| return True | ||
|
|
||
| # Being maintainer doesn't grant rights to create checks. |
There was a problem hiding this comment.
Is this a behavioural change? If yes, could this be avoided not to make upgrade difficult? Especially on large instances with many users :)
There was a problem hiding this comment.
Yes, after the change, enabling/disabling checks become an independent permission.
I suspect that, even on large instances, there are typically just one user that do CI check additions on a given project - usually a special account for it; the other maintainers shall not have any business adding CI checks.
You got a point though: it could be better to set it by default during migration. Not sure if is there a way to teach migrations to set it by default for maintainers to preserve existing behaviour.

Currently, patchwork doesn't allow granting permissions to add_checks without promoting an user to superuser.
This patch series: