Skip to content

Commit 13cfc72

Browse files
author
gdgate
authored
Merge pull request #1666 from phong-nguyen-duy/my-master
Bump bricks version to 3.7.19 Reviewed-by: https://github.com/danh-ung
2 parents fe31b4b + 08429de commit 13cfc72

18 files changed

Lines changed: 11626 additions & 1418 deletions

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.18
1+
3.7.19

bin/run_brick.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
BRICK_PARAM_PREFIX = 'BRICK_PARAM_'
99
HIDDEN_BRICK_PARAMS_PREFIX = 'HIDDEN_BRICK_PARAM_'
1010

11+
# MSF-17345 Set umask so files are group-writable
12+
File.umask(0002)
13+
1114
brick_type = !ARGV.empty? ? ARGV[0] : DEFAULT_BRICK
1215

1316
def get_brick_params(prefix)

bin/test_projects_cleanup.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ def clean_up!(client, force, days)
9090
delete_project_by_title(/LCM spec Client With Conflicting LDM Changes/, projects, days, force)
9191
delete_project_by_title(/LCM spec master project/, projects, days, force)
9292
delete_project_by_title(/users brick load test/, projects, days, force)
93-
delete_project_by_title(/#transfer_processes and #transfer_schedules test/, projects, days, force)
93+
delete_project_by_title(/transfer_processes and #transfer_schedules test/, projects, days, force)
94+
delete_project_by_title(/DailyUse Project for gooddata-ruby integration tests/, projects, days, force)
95+
delete_project_by_title(/^New project$/, projects, days, force)
96+
delete_project_by_title(/RubyGem Dev Week test/, projects, days, force)
97+
delete_project_by_title(/My project from blueprint/, projects, days, force)
9498
delete_ads_by_title(/Development ADS/, client, days, force)
9599
delete_ads_by_title(/Production ADS/, client, days, force)
96100
delete_ads_by_title(/TEST ADS/, client, days, force)
@@ -112,7 +116,7 @@ def init_client(username, password, server)
112116
prod_client = init_client(username, password, "https://#{config[:prod_server]}")
113117

114118
force = options[:force]
115-
days = options[:days] || 14
119+
days = options[:days] || 3
116120
clean_up!(dev_client, force, days)
117121
clean_up!(prod_client, force, days)
118122

lib/gooddata/lcm/actions/synchronize_ldm.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ def sync_segment_ldm(params, segment_info)
8989
maql_diff_params << :excludeFactRule if exclude_fact_rule
9090
maql_diff_params << :includeDeprecated if include_deprecated
9191
maql_diff = previous_master.maql_diff(blueprint: blueprint, params: maql_diff_params)
92+
chunks = maql_diff['projectModelDiff']['updateScripts']
93+
if chunks.empty?
94+
GoodData.logger.info "Synchronize LDM to clients will not proceed in mode \
95+
'#{params[:synchronize_ldm].downcase}' due to no LDM changes in the new master project. \
96+
If you had changed LDM of clients manually, please use mode 'diff_against_clients' \
97+
to force synchronize LDM to clients"
98+
end
9299
end
93100

94101
segment_info[:to] = segment_info[:to].pmap do |entry|

lib/gooddata/models/domain.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def users(domain, id = :all, opts = {})
241241

242242
all_users
243243
else
244-
find_user_by_login(domain, id)
244+
find_user_by_login(domain, id, opts)
245245
end
246246
end
247247

lib/gooddata/models/project.rb

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,14 +1606,19 @@ def whitelist_users(new_users, users_list, whitelist, mode = :exclude)
16061606
def import_users(new_users, options = {})
16071607
role_list = roles
16081608
users_list = users
1609-
new_users = new_users.map { |x| ((x.is_a?(Hash) && x[:user] && x[:user].to_hash.merge(role: x[:role])) || x.to_hash).tap { |u| u[:login].downcase! } }
16101609

16111610
GoodData.logger.warn("Importing users to project (#{pid})")
1611+
new_users = new_users.map { |x| ((x.is_a?(Hash) && x[:user] && x[:user].to_hash.merge(role: x[:role])) || x.to_hash).tap { |u| u[:login].downcase! } }
1612+
# First check that if groups are provided we have them set up
1613+
user_groups_cache, change_groups = check_groups(new_users.map(&:to_hash).flat_map { |u| u[:user_group] || [] }.uniq, options[:user_groups_cache], options)
16121614

1613-
whitelisted_new_users, whitelisted_users = whitelist_users(new_users.map(&:to_hash), users_list, options[:whitelists])
1615+
unless change_groups.empty?
1616+
new_users.each do |user|
1617+
user[:user_group].map! { |e| change_groups[e].nil? ? e : change_groups[e] }
1618+
end
1619+
end
16141620

1615-
# First check that if groups are provided we have them set up
1616-
user_groups_cache = check_groups(new_users.map(&:to_hash).flat_map { |u| u[:user_group] || [] }.uniq, options[:user_groups_cache], options)
1621+
whitelisted_new_users, whitelisted_users = whitelist_users(new_users.map(&:to_hash), users_list, options[:whitelists])
16171622

16181623
# conform the role on list of new users so we can diff them with the users coming from the project
16191624
diffable_new_with_default_role = whitelisted_new_users.map do |u|
@@ -1760,7 +1765,20 @@ def remove_users(list)
17601765
def check_groups(specified_groups, user_groups_cache = nil, options = {})
17611766
current_user_groups = user_groups if user_groups_cache.nil? || user_groups_cache.empty?
17621767
groups = current_user_groups.map(&:name)
1763-
missing_groups = specified_groups - groups
1768+
missing_groups = []
1769+
change_groups = {}
1770+
specified_groups.each do |group|
1771+
found_group = groups.find { |name| name.casecmp(group).zero? }
1772+
if found_group.nil?
1773+
missing_groups << group
1774+
else
1775+
# Change groups when they have similar group name with difference of case sensitivity
1776+
if found_group != group
1777+
change_groups[group] = found_group
1778+
GoodData.logger.warn("Group with name #{group} is existed in project with name #{found_group}.")
1779+
end
1780+
end
1781+
end
17641782
if options[:create_non_existing_user_groups]
17651783
missing_groups.each do |g|
17661784
GoodData.logger.info("Creating group #{g}")
@@ -1773,7 +1791,7 @@ def check_groups(specified_groups, user_groups_cache = nil, options = {})
17731791
"#{groups.join(',')} and you asked for #{missing_groups.join(',')}"
17741792
end
17751793
end
1776-
current_user_groups
1794+
[current_user_groups, change_groups]
17771795
end
17781796

17791797
# Update user

spec/integration/models/domain_spec.rb

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
end
4545
end
4646

47-
describe '#find_user_by_login' do
48-
it 'Should find user by login' do
49-
domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
50-
user = domain.find_user_by_login(ConnectionHelper::DEFAULT_USERNAME)
51-
52-
expect(user).to be_an_instance_of(GoodData::Profile)
53-
expect(user.login).to eq ConnectionHelper::DEFAULT_USERNAME
54-
end
55-
end
56-
5747
describe '#users' do
5848
it 'Should list users' do
5949
users = @domain.users
@@ -119,7 +109,7 @@
119109

120110
it 'updates properties of a profile' do
121111
user = @domain.users
122-
.reject { |u| u.login == ConnectionHelper::DEFAULT_USERNAME }.first
112+
.reject { |u| u.login == ConnectionHelper::DEFAULT_USERNAME }.first
123113

124114
old_email = user.email
125115
old_sso_provider = user.sso_provider || ''
@@ -138,6 +128,40 @@
138128
end
139129
end
140130

131+
describe '#find_user_by_login' do
132+
it 'Should find user by login' do
133+
domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
134+
user = domain.find_user_by_login(ConnectionHelper::DEFAULT_USERNAME)
135+
136+
expect(user).to be_an_instance_of(GoodData::Profile)
137+
expect(user.login).to eq ConnectionHelper::DEFAULT_USERNAME
138+
end
139+
140+
it 'Should find user by users with same result' do
141+
domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
142+
143+
password = 'gemtest871382persistent'
144+
user = domain.find_user_by_login(login)
145+
user.delete if user
146+
user = domain.add_user(:login => login, :password => password, :first_name => 'X', :last_name => 'X')
147+
@users_to_delete << user
148+
client_normal = GoodData.connect(login, password, :server => GoodData::Environment::ConnectionHelper::DEFAULT_SERVER, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
149+
begin
150+
client_normal.domain(ConnectionHelper::DEFAULT_DOMAIN).find_user_by_login(login)
151+
raise 'Must be domain admin'
152+
rescue RestClient::Forbidden => e
153+
expect(e.message).to include('Can be accessed only by domain admin')
154+
end
155+
user = domain.find_user_by_login(login)
156+
expect(user).to be_an_instance_of(GoodData::Profile)
157+
expect(user.login).to eq login
158+
user = domain.users(login)
159+
expect(user).to be_an_instance_of(GoodData::Profile)
160+
expect(user.login).to eq login
161+
client_normal.disconnect
162+
end
163+
end
164+
141165
describe '#clients' do
142166
subject { GoodData::Domain.new('my_domain') }
143167
let(:client) { double('client') }

0 commit comments

Comments
 (0)