Class: Namespaces::Groups::SharedGroupsFinder
- Inherits:
-
Object
- Object
- Namespaces::Groups::SharedGroupsFinder
- Includes:
- Gitlab::Allowable, Namespaces::GroupsFilter
- Defined in:
- app/finders/namespaces/groups/shared_groups_finder.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(group, current_user = nil, params = {}) ⇒ SharedGroupsFinder
constructor
A new instance of SharedGroupsFinder.
Methods included from Gitlab::Allowable
Constructor Details
#initialize(group, current_user = nil, params = {}) ⇒ SharedGroupsFinder
Returns a new instance of SharedGroupsFinder.
22 23 24 25 26 |
# File 'app/finders/namespaces/groups/shared_groups_finder.rb', line 22 def initialize(group, current_user = nil, params = {}) @group = group @current_user = current_user @params = params end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
20 21 22 |
# File 'app/finders/namespaces/groups/shared_groups_finder.rb', line 20 def current_user @current_user end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
20 21 22 |
# File 'app/finders/namespaces/groups/shared_groups_finder.rb', line 20 def group @group end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
20 21 22 |
# File 'app/finders/namespaces/groups/shared_groups_finder.rb', line 20 def params @params end |
Instance Method Details
#execute ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/finders/namespaces/groups/shared_groups_finder.rb', line 28 def execute return Group.none unless can?(current_user, :read_group, group) groups = group.shared_groups.public_or_visible_to_user(current_user) groups = filter_shared_groups(groups) sort(groups).with_route end |