lib/yao/resources/role.rb in yao-0.13.4 vs lib/yao/resources/role.rb in yao-0.14.0
- old
+ new
@@ -45,12 +45,12 @@
res = GET(path_for_role_resource(tenant, user))
resources_from_json(res.body)
end
# @param role_name [String]
- # @param to: [String]
- # @param on: [String]
+ # @param to [String]
+ # @param on [String]
# @return [Faraday::Response]
def grant(role_name, to:, on:)
role = Yao::Role.get(role_name)
user = Yao::User.get(to)
tenant = if api_version_v2?
@@ -62,12 +62,12 @@
# response is "204 Not Content"
PUT(path_for_role_resource(tenant, user, role))
end
# @param role_name [String]
- # @param from: [String]
- # @param on: [String]
+ # @param from [String]
+ # @param on [String]
# @return [Faraday::Response]
def revoke(role_name, from:, on:)
role = Yao::Role.get(role_name)
user = Yao::User.get(from)
tenant = if api_version_v2?
@@ -86,9 +86,11 @@
# @return [Bool]
def api_version_v2?
client.url_prefix.to_s =~ /v2\.0/
end
+ # @param tenant [String]
+ # @param user [String]
def path_for_role_resource(tenant, user, role = nil)
if api_version_v2?
paths = ["tenants", tenant.id, "users", user.id, "roles"]
paths += ["OS-KSADM", role.id] if role
else