Skip to content

Follow-up from "Hide `New subgroup` button if visibility is restricted"

The following discussion from !148758 (merged) should be addressed:

Implementation plan

  • @jarka started a discussion: (+3 comments)

    I am wondering if this could be extracted outside of the policy class.

    Maybe we could create a new method inside Gitlab::VisibilityLevel

    Ideally, in the policy class, we should use a very simple check, for example:

    condition(:create_subgroup_disabled, scope: :subject) do
      Gitlab::VisibilityLevel.allowed_levels_for_user(@user, @subject).empty?
    end

    WDYT?

Edited by Arturo Herrero