cf-uaac 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb3a16efbbbd2a3b0bff7ebab805279ace288798
4
- data.tar.gz: 7a64f69585ad57c783213e13be0689caa03352dd
3
+ metadata.gz: 6736dcdfab81463608c3dede16c118c2ed06cc83
4
+ data.tar.gz: 424c951819105b0e41d422f81dec1ba75fd791e5
5
5
  SHA512:
6
- metadata.gz: 6d0e17c6c6e7e1e75c595c7c40bd486941b05ad977437c6468e06647b43170befcb0b9f02b8e44918d37875a39cb65b42fc4782b7905f920b3fdd3d2249c44fa
7
- data.tar.gz: e20e97f7510f41dd00fe7a79e1e231e20a19d9cdb6b20dc56788cecd0d5e6c26cf752e70415e9179a2e888e089786af630877bb8376fdd3769b5cfc6c54f7337
6
+ metadata.gz: 3b8f1aa2f4a4820cc844577a1bdac71ec80dabdf073aab63638a04b8138b1ce5492ff9c3f9927e30f00039eb05d4231170a9b627fada8ccb008eed29a5405ff9
7
+ data.tar.gz: bb291dfc11b15a31c98aa3510b76653c4cde56c2ab04b8cb2da462a3799c663722aa86cf805fe17f142cfdde53523094792b2ef8de1bcc6842ee8cbbb3d766ad
@@ -88,11 +88,10 @@ class CommonCli < Topic
88
88
  def scim_common_list(type, filter)
89
89
  pp scim_request { |sr|
90
90
  query = { attributes: opts[:attrs], filter: filter }
91
- info = nil
92
- if type == :user
93
- info = sr.query(type, query.merge!(startIndex: opts[:start], count: opts[:count]))
91
+ info = if type == :user
92
+ sr.query(type, query.merge!(startIndex: opts[:start], count: opts[:count]))
94
93
  else
95
- info = opts[:start] || opts[:count] ?
94
+ opts[:start] || opts[:count] ?
96
95
  sr.query(type, query.merge!(startIndex: opts[:start], count: opts[:count])):
97
96
  sr.all_pages(type, query)
98
97
  end
@@ -109,21 +108,24 @@ class CommonCli < Topic
109
108
  info = scim.all_pages(type, query)
110
109
  raise BadResponse unless info.is_a?(Array)
111
110
  raise NotFound if info.length == 0
112
- if info.length >= 2
111
+ chosen_info = if info.length >= 2
112
+ say 'Select an origin:'
113
113
  info.each_with_index do |i, idx|
114
+ say "#{idx + 1}. #{i['origin']}"
114
115
  end
115
116
 
116
117
  choice = @highline.ask("Select user: ").to_i
117
118
  if choice > info.length || choice <= 0
118
- raise ArgumentError 'bad input, klugscheisser'
119
+ raise ArgumentError.new('bad input')
119
120
  end
120
- info = info[choice - 1]
121
+ info[choice - 1]
121
122
  else
122
- info = info[0]
123
+ info[0]
123
124
  end
124
125
 
126
+
125
127
  # when getting whole object, handle case of UAA < 1.3 which did not return meta attr from query
126
- attrs || !info["id"] || info["meta"] ? info : scim.get(type, info["id"])
128
+ attrs || !chosen_info["id"] || chosen_info["meta"] ? chosen_info : scim.get(type, chosen_info["id"])
127
129
  end
128
130
 
129
131
  def scim_get_object(scim, type, name, attrs = nil)
@@ -46,14 +46,14 @@ class Config
46
46
  exit 1
47
47
  end
48
48
  else # file doesn't exist, make sure we can write it now
49
- File.open(@config_file, 'w') { |f| f.write("--- {}\n\n") }
49
+ self.write_file(@config_file, "--- {}\n\n")
50
50
  end
51
51
  Util.hash_keys!(@config, :sym)
52
52
  @context = current_subhash(@config[@target][:contexts]) if @target = current_subhash(@config)
53
53
  end
54
54
 
55
55
  def self.save
56
- File.open(@config_file, 'w') { |f| YAML.dump(Util.hash_keys(@config, :str), f) } if @config_file
56
+ self.write_file(@config_file, YAML.dump(Util.hash_keys(@config, :str))) if @config_file
57
57
  true
58
58
  end
59
59
 
@@ -134,6 +134,11 @@ class Config
134
134
  # methods below here are not intended to be part of the public interface
135
135
  private
136
136
 
137
+ def self.write_file(filename, content)
138
+ File.open(filename, 'w') { |f| f.write content }
139
+ File.chmod(0600, filename)
140
+ end
141
+
137
142
  def self.current_subhash(hash)
138
143
  return unless hash
139
144
  key = nil
@@ -14,6 +14,6 @@
14
14
  # Cloud Foundry namespace
15
15
  module CF
16
16
  module UAA
17
- CLI_VERSION = '4.0.0'
17
+ CLI_VERSION = '4.1.0'
18
18
  end
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf-uaac
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Syer
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-08-24 00:00:00.000000000 Z
15
+ date: 2017-11-01 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: cf-uaa-lib
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
331
  version: '0'
332
332
  requirements: []
333
333
  rubyforge_project: cf-uaac
334
- rubygems_version: 2.6.11
334
+ rubygems_version: 2.5.1
335
335
  signing_key:
336
336
  specification_version: 4
337
337
  summary: Command line interface for CloudFoundry UAA