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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/group_link/group_group_link_entity.rb')
-rw-r--r--app/serializers/group_link/group_group_link_entity.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/serializers/group_link/group_group_link_entity.rb b/app/serializers/group_link/group_group_link_entity.rb
new file mode 100644
index 00000000000..cedc8bd8582
--- /dev/null
+++ b/app/serializers/group_link/group_group_link_entity.rb
@@ -0,0 +1,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