Follow-up from "Add group web-hooks failed notifications"
The following discussion from !110824 (merged) should be addressed:
-
@.luke started a discussion: (+7 comments) Suggestion
I have a concern here that we're introducing a permission
read_web_hooks
that sounds nearly identical to an existing permission calledread_web_hook
.But
read_web_hook
andread_web_hooks
seem to allow and deny differently is that right?And then another layer of confusion (for me!) is
Groups::HooksController
usesadmin_group
to decide if a hook can be viewed. I can't see where we useread_web_hook
(non-plural) in our codebase, but it's not in any controllers as far as I can see.I'm worried that we're setting ourselves up for confusion in future, over which permission is the permission to use when we want to check if a user can view web hooks for a group.
🤔 I see that we already have this set up for project hooks, and we're following the same pattern. Project hooks have:-
read_web_hooks
defined inProjectPolicy
-
read_web_hook
defined inProjectHookPolicy
And I wouldn't be sure which to use when I want to check if a user can read a project hook! Like
Group::HooksController
,Projects::HooksController
actually just usesadmin_project
to decide if someone can see the hook.
Just to step back a bit - is the intention of this new permission really just to check if we should display the callout, which is to say, maintainers should see it and no one else - and in that case, could we just check again
maintainer_access
for both the group and project call out?Ability.allowed?(current_user, :maintainer_access, group)
-