Commit 60f7d19a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix rubocop complains

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 940e504a
module GroupMembersHelper module GroupMembersHelper
def clear_ldap_permission_cache_message def clear_ldap_permission_cache_message
markdown(<<-EOT.strip_heredoc markdown(
<<-EOT.strip_heredoc
Be careful, all members of this group (except you) will have their Be careful, all members of this group (except you) will have their
**access level temporarily downgraded** to `Guest`. The next time that a group member **access level temporarily downgraded** to `Guest`. The next time that a group member
signs in to GitLab (or after one hour, whichever occurs first) their access level will signs in to GitLab (or after one hour, whichever occurs first) their access level will
......
...@@ -67,7 +67,7 @@ class JenkinsService < CiService ...@@ -67,7 +67,7 @@ class JenkinsService < CiService
def build_page(sha, ref = nil) def build_page(sha, ref = nil)
if multiproject_enabled? && ref.present? if multiproject_enabled? && ref.present?
URI.encode("#{base_project_url}/#{project.name}_#{ref.gsub('/', '_')}/scm/bySHA1/#{sha}").to_s URI.encode("#{base_project_url}/#{project.name}_#{ref.tr('/', '_')}/scm/bySHA1/#{sha}").to_s
else else
"#{project_url}/scm/bySHA1/#{sha}" "#{project_url}/scm/bySHA1/#{sha}"
end end
......
...@@ -72,7 +72,7 @@ module API ...@@ -72,7 +72,7 @@ module API
expose :shared_runners_enabled expose :shared_runners_enabled
expose :creator_id expose :creator_id
expose :namespace expose :namespace
expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda{ |project, options| project.forked? } expose :forked_from_project, using: Entities::ForkedFromProject, if: lambda { |project, options| project.forked? }
expose :avatar_url expose :avatar_url
expose :star_count, :forks_count expose :star_count, :forks_count
expose :open_issues_count, if: lambda { |project, options| project.issues_enabled? && project.default_issues_tracker? } expose :open_issues_count, if: lambda { |project, options| project.issues_enabled? && project.default_issues_tracker? }
...@@ -90,7 +90,7 @@ module API ...@@ -90,7 +90,7 @@ module API
class Group < Grape::Entity class Group < Grape::Entity
expose :id, :name, :path, :ldap_cn, :ldap_access, :description expose :id, :name, :path, :ldap_cn, :ldap_access, :description
expose :ldap_group_links, using: Entities::LdapGroupLink, if: lambda{ | group, options | group.ldap_group_links.any? } expose :ldap_group_links, using: Entities::LdapGroupLink, if: lambda { |group, options| group.ldap_group_links.any? }
expose :avatar_url expose :avatar_url
expose :web_url do |group, options| expose :web_url do |group, options|
......
...@@ -13,7 +13,7 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -13,7 +13,7 @@ describe Gitlab::LDAP::Access, lib: true do
end end
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
it 'should block user in GitLab' do it 'should block user in GitLab' do
access.allowed? access.allowed?
expect(user).to be_blocked expect(user).to be_blocked
...@@ -211,7 +211,7 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -211,7 +211,7 @@ describe Gitlab::LDAP::Access, lib: true do
it "should give admin privileges to an User" do it "should give admin privileges to an User" do
admin_group = Net::LDAP::Entry.from_single_ldif_string( admin_group = Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com %Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com
cn: #{access.admin_group} cn: #{access.admin_group}
description: GitLab admins description: GitLab admins
gidnumber: 42 gidnumber: 42
...@@ -220,7 +220,7 @@ memberuid: admin2 ...@@ -220,7 +220,7 @@ memberuid: admin2
memberuid: admin3 memberuid: admin3
objectclass: top objectclass: top
objectclass: posixGroup objectclass: posixGroup
}) })
allow_any_instance_of(Gitlab::LDAP::Adapter).to receive(:group) { Gitlab::LDAP::Group.new(admin_group) } allow_any_instance_of(Gitlab::LDAP::Adapter).to receive(:group) { Gitlab::LDAP::Group.new(admin_group) }
expect{ access.update_admin_status }.to change(user, :admin?).to(true) expect{ access.update_admin_status }.to change(user, :admin?).to(true)
...@@ -229,7 +229,7 @@ objectclass: posixGroup ...@@ -229,7 +229,7 @@ objectclass: posixGroup
it "should remove admin privileges from an User" do it "should remove admin privileges from an User" do
user.update_attribute(:admin, true) user.update_attribute(:admin, true)
admin_group = Net::LDAP::Entry.from_single_ldif_string( admin_group = Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com %Q{dn: cn=#{access.admin_group},ou=groups,dc=bar,dc=com
cn: #{access.admin_group} cn: #{access.admin_group}
description: GitLab admins description: GitLab admins
gidnumber: 42 gidnumber: 42
...@@ -237,7 +237,7 @@ memberuid: admin1 ...@@ -237,7 +237,7 @@ memberuid: admin1
memberuid: admin3 memberuid: admin3
objectclass: top objectclass: top
objectclass: posixGroup objectclass: posixGroup
}) })
allow_any_instance_of(Gitlab::LDAP::Adapter).to receive(:group) { Gitlab::LDAP::Group.new(admin_group) } allow_any_instance_of(Gitlab::LDAP::Adapter).to receive(:group) { Gitlab::LDAP::Group.new(admin_group) }
expect{ access.update_admin_status }.to change(user, :admin?).to(false) expect{ access.update_admin_status }.to change(user, :admin?).to(false)
end end
...@@ -350,7 +350,7 @@ objectclass: posixGroup ...@@ -350,7 +350,7 @@ objectclass: posixGroup
describe 'ldap_groups' do describe 'ldap_groups' do
let(:ldap_group_1) do let(:ldap_group_1) do
Net::LDAP::Entry.from_single_ldif_string( Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=#{access.ldap_config.admin_group},ou=groups,dc=bar,dc=com %Q{dn: cn=#{access.ldap_config.admin_group},ou=groups,dc=bar,dc=com
cn: #{access.ldap_config.admin_group} cn: #{access.ldap_config.admin_group}
description: GitLab group 1 description: GitLab group 1
gidnumber: 42 gidnumber: 42
...@@ -358,7 +358,7 @@ memberuid: user1 ...@@ -358,7 +358,7 @@ memberuid: user1
memberuid: user2 memberuid: user2
objectclass: top objectclass: top
objectclass: posixGroup objectclass: posixGroup
}) })
end end
it "returns an interator of LDAP Groups" do it "returns an interator of LDAP Groups" do
...@@ -380,7 +380,7 @@ objectclass: posixGroup ...@@ -380,7 +380,7 @@ objectclass: posixGroup
describe :cns_with_access do describe :cns_with_access do
let(:ldap_group_response_1) do let(:ldap_group_response_1) do
Net::LDAP::Entry.from_single_ldif_string( Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=group1,ou=groups,dc=bar,dc=com %Q{dn: cn=group1,ou=groups,dc=bar,dc=com
cn: group1 cn: group1
description: GitLab group 1 description: GitLab group 1
gidnumber: 21 gidnumber: 21
...@@ -388,11 +388,12 @@ uniquemember: #{ldap_user.dn.downcase} ...@@ -388,11 +388,12 @@ uniquemember: #{ldap_user.dn.downcase}
uniquemember: uid=user2,ou=people,dc=example uniquemember: uid=user2,ou=people,dc=example
objectclass: top objectclass: top
objectclass: posixGroup objectclass: posixGroup
}) })
end end
let(:ldap_group_response_2) do let(:ldap_group_response_2) do
Net::LDAP::Entry.from_single_ldif_string( Net::LDAP::Entry.from_single_ldif_string(
%Q{dn: cn=group2,ou=groups,dc=bar,dc=com %Q{dn: cn=group2,ou=groups,dc=bar,dc=com
cn: group2 cn: group2
description: GitLab group 2 description: GitLab group 2
gidnumber: 42 gidnumber: 42
...@@ -400,14 +401,16 @@ memberuid: user3 ...@@ -400,14 +401,16 @@ memberuid: user3
memberuid: user4 memberuid: user4
objectclass: top objectclass: top
objectclass: posixGroup objectclass: posixGroup
}) })
end end
let(:ldap_groups) do let(:ldap_groups) do
[ [
Gitlab::LDAP::Group.new(ldap_group_response_1), Gitlab::LDAP::Group.new(ldap_group_response_1),
Gitlab::LDAP::Group.new(ldap_group_response_2) Gitlab::LDAP::Group.new(ldap_group_response_2)
] ]
end end
let(:ldap_user) { Gitlab::LDAP::Person.new(Net::LDAP::Entry.new, user.ldap_identity.provider) } let(:ldap_user) { Gitlab::LDAP::Person.new(Net::LDAP::Entry.new, user.ldap_identity.provider) }
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment