diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-08-11 01:44:40 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-09-01 16:58:38 -0400 |
commit | 454d227b45a563cb21ea8fa5091e687a2876380f (patch) | |
tree | dc43ff7ddfcb4b3ca22ffcf9b80e74eabd9bf6d1 /lib | |
parent | afb2e6f48548ce3c5dc3279265bfd8b9dedf9e0d (diff) | |
download | gitlab-ce-454d227b45a563cb21ea8fa5091e687a2876380f.tar.gz |
Remove all permission checking from Reference filters
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/markdown/cross_project_reference.rb | 11 | ||||
-rw-r--r-- | lib/gitlab/markdown/user_reference_filter.rb | 6 |
2 files changed, 2 insertions, 15 deletions
diff --git a/lib/gitlab/markdown/cross_project_reference.rb b/lib/gitlab/markdown/cross_project_reference.rb index 855748fdccc..6ab04a584b0 100644 --- a/lib/gitlab/markdown/cross_project_reference.rb +++ b/lib/gitlab/markdown/cross_project_reference.rb @@ -13,18 +13,11 @@ module Gitlab # # ref - String reference. # - # Returns a Project, or nil if the reference can't be accessed + # Returns a Project, or nil if the reference can't be found def project_from_ref(ref) return context[:project] unless ref - other = Project.find_with_namespace(ref) - return nil unless other && user_can_reference_project?(other) - - other - end - - def user_can_reference_project?(project, user = context[:current_user]) - Ability.abilities.allowed?(user, :read_project, project) + Project.find_with_namespace(ref) end end end diff --git a/lib/gitlab/markdown/user_reference_filter.rb b/lib/gitlab/markdown/user_reference_filter.rb index 1871e52df0e..0446cd49f8e 100644 --- a/lib/gitlab/markdown/user_reference_filter.rb +++ b/lib/gitlab/markdown/user_reference_filter.rb @@ -80,8 +80,6 @@ module Gitlab end def link_to_group(group, namespace) - return unless user_can_reference_group?(namespace) - push_result(:user, *namespace.users) url = urls.group_url(group, only_path: context[:only_path]) @@ -100,10 +98,6 @@ module Gitlab text = User.reference_prefix + user %(<a href="#{url}" #{data} class="#{link_class}">#{text}</a>) end - - def user_can_reference_group?(group) - Ability.abilities.allowed?(context[:current_user], :read_group, group) - end end end end |