Welcome to mirror list, hosted at ThFree Co, Russian Federation.

group_group_link_entity.rb « group_link « serializers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cedc8bd8582aa26a7b8091d8c0ab66036e477f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module GroupLink
  class GroupGroupLinkEntity < GroupLink::GroupLinkEntity
    include RequestAwareEntity

    expose :can_update do |group_link|
      can_manage?(group_link)
    end

    expose :can_remove do |group_link|
      can_manage?(group_link)
    end

    private

    def current_user
      options[:current_user]
    end

    def can_manage?(group_link)
      can?(current_user, :admin_group_member, group_link.shared_group)
    end
  end
end