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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97f7ce778de07ac5c70631f69d24c84bf9aad453dcf68ee28518f85b6bca7e03
4
- data.tar.gz: d8b9d202a25cb88c501ac0e4101245c9c582990401b400ef759e057986b67864
3
+ metadata.gz: e4f8e6e99d7124c4a1654be470312d6749c475d0cfbc23b33c72962d13fe0e1e
4
+ data.tar.gz: d2f43cb3bf00ddacce6cd24e92578d9876cfcbfa6b05cbdf6db68a5fbba732d9
5
5
  SHA512:
6
- metadata.gz: 182e6262ddc79f9f88d94505c9b1488dd5f69e19d7e3edfb854ab74378519c83bf60056b709572c21a994c3420802a022eb4a9679395cc7f195e592ca9725c9e
7
- data.tar.gz: 8a0fb76bc633bff58dbb8957fef6bf18a41f2bcc11baf27465a2a8b267625511bb0817207975f58c32daf9c51d78b4016fd1f155f121e509dc3b30ef016f87f0
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- WF_SDK_VERSION = '5.0.0'
3
+ WF_SDK_VERSION = '5.0.1'
4
4
  WF_SDK_LOCATION = Pathname.new(__dir__).parent.parent.parent
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher