Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix backward compatibility for member add to uaa 1.2.6

  • Loading branch information...
commit 001b7d24bc2d8712cd1e98a9c0e2e6698bde3dba 1 parent 1267c14
@daleolds daleolds authored
View
9 lib/cli/common.rb
@@ -83,9 +83,12 @@ def update_target_info(info = nil)
def scim_common_list(type, filter)
pp scim_request { |sr|
query = { attributes: opts[:attrs], filter: filter }
- opts[:start] || opts[:count] ?
+ info = opts[:start] || opts[:count] ?
sr.query(type, query.merge!(startIndex: opts[:start], count: opts[:count])):
sr.all_pages(type, query)
+ nattr = sr.name_attr(type).downcase
+ info.is_a?(Array) && info.length > 0 && info[0][nattr] ?
+ info.each_with_object({}) { |v, h| h[v.delete(nattr)] = v } : info
}
end
@@ -94,7 +97,9 @@ def scim_get_object(scim, type, name, attrs = nil)
info = scim.all_pages(type, query)
raise BadResponse unless info.is_a?(Array) && info.length < 2
raise NotFound if info.length == 0
- info[0]
+ info = info[0]
+ # when getting whole object, handle case of UAA < 1.3 which did not return meta attr from query
+ attrs || !info["id"] || info["meta"]? info : scim.get(type, info["id"])
end
end
View
2  lib/cli/version.rb
@@ -14,6 +14,6 @@
# Cloud Foundry namespace
module CF
module UAA
- CLI_VERSION = "1.3.8"
+ CLI_VERSION = "1.3.9"
end
end
View
2  spec/group_spec.rb
@@ -54,7 +54,6 @@ module CF::UAA
Cli.output.string.should include @test_group
Cli.run("group get #{@test_group.upcase}").should be
Cli.output.string.should include @test_group
- pending "real uaa can't add members to scim.read group yet" unless @stub_uaa
Cli.run("member add scim.read #{@test_user}w").should be
end
@@ -109,7 +108,6 @@ def check_members
it "adds one writer to the group" do
Cli.run("group writer add #{@test_group} #{@test_user}w").should be
- Cli.run("group reader add #{@test_group} #{@test_user}w").should be
Cli.output.string.should include "success"
end
View
2  spec/setup_helper.rb
@@ -18,7 +18,7 @@
client = ENV["UAA_CLIENT_ID"] || "admin"
secret = ENV["UAA_CLIENT_SECRET"] || "adminsecret"
-abort("UAA_CLIENT_TARGET is not set") unless target = ENV["UAA_CLIENT_TARGET"]
+target = ENV["UAA_CLIENT_TARGET"] || "http://localhost:8080/uaa"
[
"target #{target}",
Please sign in to comment.
Something went wrong with that request. Please try again.