cf-uaac 3.13.1 → 4.0.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: 8ef367062c3e28c384a318cbf086099558e965a4
4
- data.tar.gz: 2cc9ad180ad1a8ccdb88eab48191cc8931bd336c
3
+ metadata.gz: cb3a16efbbbd2a3b0bff7ebab805279ace288798
4
+ data.tar.gz: 7a64f69585ad57c783213e13be0689caa03352dd
5
5
  SHA512:
6
- metadata.gz: c56c0743dbede318336371e6d731d0f6d895a949f41905bc60cd492348a8ae818b21cf4f0f7cbb85ebc5ae3a5b46195c44e674315a074fa97d3df55325adbfc6
7
- data.tar.gz: ade14cd1d7aeec495397587b486327cf046794e68c8a5a902005b25f0124b8db7c9d50e966f828bcf3fe390ee0c15bc4e22c75a4e52de6481f1249598a50c17a
6
+ metadata.gz: 6d0e17c6c6e7e1e75c595c7c40bd486941b05ad977437c6468e06647b43170befcb0b9f02b8e44918d37875a39cb65b42fc4782b7905f920b3fdd3d2249c44fa
7
+ data.tar.gz: e20e97f7510f41dd00fe7a79e1e231e20a19d9cdb6b20dc56788cecd0d5e6c26cf752e70415e9179a2e888e089786af630877bb8376fdd3769b5cfc6c54f7337
@@ -145,7 +145,9 @@ class GroupCli < CommonCli
145
145
  group = scim_get_object(scim, :group, gname(name))
146
146
 
147
147
  old_members = (group['members'] || [])
148
- new_members = find_members(scim, members)
148
+ new_members = find_members(scim, members).map do |member|
149
+ member.merge('origin' => 'uaa')
150
+ end
149
151
 
150
152
  unless new_members.size == members.size
151
153
  raise 'not all users found, none added'
@@ -183,25 +185,6 @@ class GroupCli < CommonCli
183
185
  'success'
184
186
  end
185
187
 
186
- def update_members(scim, name, attr, users, add = true)
187
- group = scim_get_object(scim, :group, gname(name))
188
- old_ids = id_set(group[attr] || [])
189
- new_ids = id_set(scim.ids(:user, *users))
190
- if add
191
- raise 'not all users found, none added' unless new_ids.size == users.size
192
- group[attr] = (old_ids + new_ids).to_a
193
- raise 'no new users given' unless group[attr].size > old_ids.size
194
- else
195
- raise 'not all users found, none deleted' unless new_ids.size == users.size
196
- group[attr] = (old_ids - new_ids).to_a
197
- raise 'no existing users to delete' unless group[attr].size < old_ids.size
198
- group.delete(attr) if group[attr].empty?
199
- end
200
-
201
- scim.put(:group, group)
202
- 'success'
203
- end
204
-
205
188
  desc "member add [name] [users...]", "add members to a group" do |name, *users|
206
189
  pp scim_request { |scim| add_members(scim, name, users) }
207
190
  end
@@ -209,23 +192,6 @@ class GroupCli < CommonCli
209
192
  desc "member delete [name] [users...]", "remove members from a group" do |name, *users|
210
193
  pp scim_request { |scim| delete_members(scim, name, users) }
211
194
  end
212
-
213
- desc "group reader add [name] [users...]", "add users who can read the members" do |name, *users|
214
- pp scim_request { |scim| update_members(scim, name, "readers", users) }
215
- end
216
-
217
- desc "group reader delete [name] [users...]", "delete users who can read members" do |name, *users|
218
- pp scim_request { |scim| update_members(scim, name, "readers", users, false) }
219
- end
220
-
221
- desc "group writer add [name] [users...]", "add users who can modify group" do |name, *users|
222
- pp scim_request { |scim| update_members(scim, name, "writers", users) }
223
- end
224
-
225
- desc "group writer delete [name] [users...]", "remove user who can modify group" do |name, *users|
226
- pp scim_request { |scim| update_members(scim, name, "writers", users, false) }
227
- end
228
-
229
195
  private
230
196
 
231
197
  def is_natural_number?(input)
@@ -14,6 +14,6 @@
14
14
  # Cloud Foundry namespace
15
15
  module CF
16
16
  module UAA
17
- CLI_VERSION = '3.13.1'
17
+ CLI_VERSION = '4.0.0'
18
18
  end
19
19
  end
@@ -101,57 +101,6 @@ describe GroupCli do
101
101
  check_members
102
102
  end
103
103
 
104
- it "adds one reader to the group" do
105
- Cli.run("group reader add #{@test_group} #{@test_user}r").should be
106
- Cli.output.string.should include "success"
107
- end
108
-
109
- it "adds one writer to the group" do
110
- Cli.run("group writer add #{@test_group} #{@test_user}w").should be
111
- Cli.output.string.should include "success"
112
- end
113
-
114
- it "gets readers and writers in the group" do
115
- Cli.run("group get #{@test_group}").should be
116
- Cli.output.string.should be
117
- end
118
-
119
- it "reads members as a reader" do
120
- pending "Test not applicable in integration test runs" if ENV["UAA_CLIENT_TARGET"]
121
-
122
- Cli.run("token owner get #{@test_client} -s #{@test_secret} #{@test_user}r -p #{@test_pwd}").should be
123
- Cli.run("group get #{@test_group} -a memBers").should be
124
- ids = Cli.output.string.scan(/.*value:\s+([^\s]+)/).flatten
125
- @users.size.should == ids.size
126
- end
127
-
128
- it "can't write members as a reader" do
129
- Cli.run("token owner get #{@test_client} -s #{@test_secret} #{@test_user}r -p #{@test_pwd}").should be
130
- Cli.run("member add #{@test_group} #{@test_user}z").should_not be
131
- Cli.output.string.should include "access_denied"
132
- end
133
-
134
- it "adds a member as a writer" do
135
- pending "Test not applicable in integration test runs" if ENV["UAA_CLIENT_TARGET"]
136
-
137
- Cli.run "context #{@test_client}"
138
- Cli.run("user add #{@test_user}z -p #{@test_pwd} --email sam@example.com").should be
139
- @users << "#{@test_user}z"
140
- Cli.run("token owner get #{@test_client} -s #{@test_secret} #{@test_user}w -p #{@test_pwd}").should be
141
- Cli.run("member add #{@test_group} #{@test_user}z").should be
142
- Cli.run("group get #{@test_group} -a memBers").should be
143
- ids = Cli.output.string.scan(/.*value:\s+([^\s]+)/).flatten
144
- @users.size.should == ids.size
145
- # check_members
146
- end
147
-
148
- it "can't read members as a non-reader" do
149
- pending "real uaa still returns members even if user is not in readers list" unless @stub_uaa
150
- Cli.run("token owner get #{@test_client} -s #{@test_secret} #{@test_user}m -p #{@test_pwd}").should be
151
- Cli.run("group get #{@test_group}").should be_nil
152
- Cli.output.string.should include "NotFound"
153
- end
154
-
155
104
  it "deletes all members from a group" do
156
105
  Cli.run "context #{@test_client}"
157
106
  cmd = "member delete #{@test_group.downcase} "
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: 3.13.1
4
+ version: 4.0.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-07-28 00:00:00.000000000 Z
15
+ date: 2017-08-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: cf-uaa-lib