wavefront-sdk 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +4 -0
- data/lib/wavefront-sdk/defs/version.rb +1 -1
- data/lib/wavefront-sdk/role.rb +24 -0
- data/spec/wavefront-sdk/role_spec.rb +28 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4f8e6e99d7124c4a1654be470312d6749c475d0cfbc23b33c72962d13fe0e1e
|
4
|
+
data.tar.gz: d2f43cb3bf00ddacce6cd24e92578d9876cfcbfa6b05cbdf6db68a5fbba732d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b01743fb3be2eaa72ff58f857eac4f640354ec6264436e764b0f5852b987a54f16d5fde57235b29b3c7ed5623ebca1894d467da1624f56fb8a185c5becded20c
|
7
|
+
data.tar.gz: 81953b85f6638f802619f8481f70a0e98129f26139ed06d70c28ce100b266dfd13fa1279112698e13a7ecf74364d781608ad3e20feb9c4451ef21070e511516a
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.0.1 (2020-07-08)
|
4
|
+
* Reinstate `Wavefront::Role#grant` and `Wavefront::Role#revoke`, which were
|
5
|
+
accidentally removed prior to release of 5.0.0.
|
6
|
+
|
3
7
|
## 5.0.0 (2020-07-08)
|
4
8
|
* Remove `Wavefront::UserGroup#grant` and `Wavefront::UserGroup#revoke` as [the
|
5
9
|
API paths they used have been
|
data/lib/wavefront-sdk/role.rb
CHANGED
@@ -100,5 +100,29 @@ module Wavefront
|
|
100
100
|
assignees,
|
101
101
|
'application/json')
|
102
102
|
end
|
103
|
+
|
104
|
+
# POST /api/v2/role/grant/{permission}
|
105
|
+
# Grants a single permission to role(s)
|
106
|
+
# @param permission [String] permission to grant
|
107
|
+
# @param roles [Array[String]] list of roles to receive permission
|
108
|
+
# @return [Wavefront::Response]
|
109
|
+
#
|
110
|
+
def grant(permission, roles)
|
111
|
+
wf_permission?(permission)
|
112
|
+
validate_role_list(roles)
|
113
|
+
api.post(['grant', permission].uri_concat, roles, 'application/json')
|
114
|
+
end
|
115
|
+
|
116
|
+
# POST /api/v2/role/revoke/{permission}
|
117
|
+
# Revokes a single permission from role(s)
|
118
|
+
# @param permission [String] permission to revoke
|
119
|
+
# @param roles [Array[String]] list of roles to lose permission
|
120
|
+
# @return [Wavefront::Response]
|
121
|
+
#
|
122
|
+
def revoke(permission, roles)
|
123
|
+
wf_permission?(permission)
|
124
|
+
validate_role_list(roles)
|
125
|
+
api.post(['revoke', permission].uri_concat, roles, 'application/json')
|
126
|
+
end
|
103
127
|
end
|
104
128
|
end
|
@@ -33,6 +33,34 @@ class WavefrontRoleTest < WavefrontTestBase
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def test_grant
|
37
|
+
assert_posts("/api/v2/role/grant/#{permission}", roles.to_json) do
|
38
|
+
wf.grant(permission, roles)
|
39
|
+
end
|
40
|
+
|
41
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
42
|
+
wf.grant(permission, [invalid_id])
|
43
|
+
end
|
44
|
+
|
45
|
+
assert_raises(Wavefront::Exception::InvalidPermission) do
|
46
|
+
wf.grant('made_up_permission', roles)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_revoke
|
51
|
+
assert_posts("/api/v2/role/revoke/#{permission}", roles.to_json) do
|
52
|
+
wf.revoke(permission, roles)
|
53
|
+
end
|
54
|
+
|
55
|
+
assert_raises(Wavefront::Exception::InvalidRoleId) do
|
56
|
+
wf.revoke(permission, [invalid_id])
|
57
|
+
end
|
58
|
+
|
59
|
+
assert_raises(Wavefront::Exception::InvalidPermission) do
|
60
|
+
wf.revoke('made_up_permission', roles)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
36
64
|
private
|
37
65
|
|
38
66
|
def api_class
|