conjur-api 5.3.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +8 -0
- data/.overcommit.yml +16 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_settings.yml +85 -0
- data/.rubocop_todo.yml +709 -0
- data/CHANGELOG.md +4 -0
- data/README.md +19 -1
- data/lib/conjur-api/version.rb +1 -1
- data/lib/conjur/acts_as_role.rb +15 -19
- data/lib/conjur/api/host_factories.rb +20 -19
- data/lib/conjur/api/resources.rb +15 -19
- data/lib/conjur/api/router/v5.rb +22 -7
- data/lib/conjur/base_object.rb +13 -20
- data/lib/conjur/build_object.rb +13 -20
- data/lib/conjur/id.rb +22 -19
- data/lib/conjur/role_grant.rb +13 -18
- data/spec/api/host_factories_spec.rb +34 -0
- data/spec/id_spec.rb +29 -0
- data/spec/uri_escape_spec.rb +14 -2
- data/test.sh +7 -1
- metadata +12 -6
- data/lib/conjur/cast.rb +0 -41
- data/spec/cast_spec.rb +0 -21
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Conjur::API
|
2
2
|
|
3
|
-
Programmatic Ruby access to the Conjur API.
|
3
|
+
Programmatic Ruby access to the Conjur API.
|
4
4
|
|
5
5
|
RDocs are available from the through the [Ruby Gem details page](https://rubygems.org/gems/conjur-api)
|
6
6
|
|
@@ -220,6 +220,24 @@ To bring it down, run:
|
|
220
220
|
$ docker-compose down
|
221
221
|
```
|
222
222
|
|
223
|
+
# Releasing
|
224
|
+
Releasing a new version of this Gem involves a two step process:
|
225
|
+
1. Tag and Release (using `bin/release`)
|
226
|
+
2. Approving the push to RubyGems in Jenkins
|
227
|
+
|
228
|
+
Before releasing, make sure:
|
229
|
+
- The version file (`lib/conjur-api/version.rb`) has been updated with an appropriate Semantic version number.
|
230
|
+
- The `CHANGELOG.md` file has been updated to reflect the release version and appropriate release notes.
|
231
|
+
|
232
|
+
Save, but do not commit these the changes above. When your ready to release, run the following:
|
233
|
+
```sh
|
234
|
+
$ bin/release
|
235
|
+
```
|
236
|
+
|
237
|
+
Navigate to Jenkins, and approve: https://jenkins.conjur.net/job/cyberark--conjur-api-ruby/job/master/.
|
238
|
+
|
239
|
+
Finally, verify that the new library is present in RubyGems: https://rubygems.org/gems/conjur-api
|
240
|
+
|
223
241
|
# Contributing
|
224
242
|
|
225
243
|
1. Fork it
|
data/lib/conjur-api/version.rb
CHANGED
data/lib/conjur/acts_as_role.rb
CHANGED
@@ -1,23 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2013-2018 CyberArk Ltd.
|
1
4
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
13
8
|
#
|
14
|
-
#
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
10
|
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
21
17
|
module Conjur
|
22
18
|
|
23
19
|
# This module provides methods for things that have an associated {Conjur::Role}.
|
@@ -100,7 +96,7 @@ module Conjur
|
|
100
96
|
end
|
101
97
|
if filter = options.delete(:filter)
|
102
98
|
filter = [filter] unless filter.is_a?(Array)
|
103
|
-
options["filter"] = filter.map
|
99
|
+
options["filter"] = filter.map(&Id.method(:new))
|
104
100
|
end
|
105
101
|
|
106
102
|
result = JSON.parse(rbac_role_resource[options_querystring options].get)
|
@@ -143,4 +139,4 @@ module Conjur
|
|
143
139
|
url_for(:roles_role, credentials, id)
|
144
140
|
end
|
145
141
|
end
|
146
|
-
end
|
142
|
+
end
|
@@ -1,23 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2013-2018 CyberArk Ltd.
|
1
4
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
13
8
|
#
|
14
|
-
#
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
10
|
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
21
17
|
require 'conjur/host_factory'
|
22
18
|
|
23
19
|
module Conjur
|
@@ -40,9 +36,14 @@ module Conjur
|
|
40
36
|
# @return [Host]
|
41
37
|
def host_factory_create_host token, id, options = {}
|
42
38
|
token = token.token if token.is_a?(HostFactoryToken)
|
43
|
-
response = url_for(:host_factory_create_host, token)
|
39
|
+
response = url_for(:host_factory_create_host, token)
|
40
|
+
.post(options.merge(id: id)).body
|
41
|
+
|
44
42
|
attributes = JSON.parse(response)
|
45
|
-
|
43
|
+
# in v4 'id' is just the identifier
|
44
|
+
host_id = attributes['roleid'] || attributes['id']
|
45
|
+
|
46
|
+
Host.new(host_id, {}).tap do |host|
|
46
47
|
host.attributes = attributes
|
47
48
|
end
|
48
49
|
end
|
data/lib/conjur/api/resources.rb
CHANGED
@@ -1,23 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2013-2018 CyberArk Ltd.
|
1
4
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
13
8
|
#
|
14
|
-
#
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
10
|
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
21
17
|
require 'conjur/resource'
|
22
18
|
|
23
19
|
module Conjur
|
@@ -27,8 +23,8 @@ module Conjur
|
|
27
23
|
|
28
24
|
#@!group Resources
|
29
25
|
|
30
|
-
# Find a resource by
|
31
|
-
#
|
26
|
+
# Find a resource by its id.
|
27
|
+
# @note The id given to this method must be fully qualified.
|
32
28
|
#
|
33
29
|
# ### Permissions
|
34
30
|
#
|
data/lib/conjur/api/router/v5.rb
CHANGED
@@ -1,10 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2017-2018 CyberArk Ltd.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
1
17
|
module Conjur
|
2
18
|
class API
|
3
19
|
module Router
|
4
20
|
module V5
|
5
21
|
extend Conjur::Escape::ClassMethods
|
6
22
|
extend Conjur::QueryString
|
7
|
-
extend Conjur::Cast
|
8
23
|
extend self
|
9
24
|
|
10
25
|
def authn_login account, username, password
|
@@ -28,7 +43,7 @@ module Conjur
|
|
28
43
|
end
|
29
44
|
|
30
45
|
def authn_rotate_api_key credentials, account, id
|
31
|
-
RestClient::Resource.new(Conjur.configuration.core_url, credentials)['authn'][
|
46
|
+
RestClient::Resource.new(Conjur.configuration.core_url, credentials)['authn'][fully_escape account]["api_key?role=#{id}"]
|
32
47
|
end
|
33
48
|
|
34
49
|
def authn_rotate_own_api_key account, username, password
|
@@ -51,18 +66,18 @@ module Conjur
|
|
51
66
|
end
|
52
67
|
|
53
68
|
def policies_load_policy credentials, account, id
|
54
|
-
RestClient::Resource.new(Conjur.configuration.core_url, credentials)['policies'][
|
69
|
+
RestClient::Resource.new(Conjur.configuration.core_url, credentials)['policies'][fully_escape account]['policy'][fully_escape id]
|
55
70
|
end
|
56
71
|
|
57
72
|
def public_keys_for_user account, username
|
58
|
-
RestClient::Resource.new(Conjur.configuration.core_url)['public_keys'][fully_escape account]['user'][
|
73
|
+
RestClient::Resource.new(Conjur.configuration.core_url)['public_keys'][fully_escape account]['user'][fully_escape username]
|
59
74
|
end
|
60
75
|
|
61
76
|
def resources credentials, account, kind, options
|
62
77
|
credentials ||= {}
|
63
78
|
|
64
|
-
path = "/resources/#{
|
65
|
-
path += "/#{
|
79
|
+
path = "/resources/#{fully_escape account}"
|
80
|
+
path += "/#{fully_escape kind}" if kind
|
66
81
|
|
67
82
|
RestClient::Resource.new(Conjur.configuration.core_url, credentials)[path][options_querystring options]
|
68
83
|
end
|
@@ -82,7 +97,7 @@ module Conjur
|
|
82
97
|
options = {}
|
83
98
|
options[:check] = true
|
84
99
|
options[:privilege] = privilege
|
85
|
-
options[:role] =
|
100
|
+
options[:role] = query_escape(Id.new(role)) if role
|
86
101
|
resources_resource(credentials, id)[options_querystring options].get
|
87
102
|
end
|
88
103
|
|
data/lib/conjur/base_object.rb
CHANGED
@@ -1,28 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2013-2018 CyberArk Ltd.
|
1
4
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
13
8
|
#
|
14
|
-
#
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
10
|
#
|
21
|
-
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
22
16
|
|
23
17
|
module Conjur
|
24
18
|
class BaseObject
|
25
|
-
include Cast
|
26
19
|
include QueryString
|
27
20
|
include LogSource
|
28
21
|
include BuildObject
|
@@ -31,7 +24,7 @@ module Conjur
|
|
31
24
|
attr_reader :id, :credentials
|
32
25
|
|
33
26
|
def initialize id, credentials
|
34
|
-
@id =
|
27
|
+
@id = Id.new id
|
35
28
|
@credentials = credentials
|
36
29
|
end
|
37
30
|
|
data/lib/conjur/build_object.rb
CHANGED
@@ -1,37 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2013-2018 CyberArk Ltd.
|
1
4
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
13
8
|
#
|
14
|
-
#
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
10
|
#
|
21
|
-
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
22
16
|
|
23
17
|
module Conjur
|
24
18
|
module BuildObject
|
25
19
|
def self.included base
|
26
20
|
base.module_eval do
|
27
|
-
extend Cast
|
28
21
|
extend ClassMethods
|
29
22
|
end
|
30
23
|
end
|
31
24
|
|
32
25
|
module ClassMethods
|
33
26
|
def build_object id, credentials, default_class:
|
34
|
-
id =
|
27
|
+
id = Id.new id
|
35
28
|
class_name = id.kind.classify.to_sym
|
36
29
|
find_class(class_name, default_class)
|
37
30
|
.new(id, credentials)
|
data/lib/conjur/id.rb
CHANGED
@@ -1,23 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2013-2018 CyberArk Ltd.
|
1
4
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
13
8
|
#
|
14
|
-
#
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
10
|
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
21
17
|
require 'conjur/escape'
|
22
18
|
|
23
19
|
module Conjur
|
@@ -28,7 +24,7 @@ module Conjur
|
|
28
24
|
attr_reader :id
|
29
25
|
|
30
26
|
def initialize id
|
31
|
-
@id = id
|
27
|
+
@id = Id.normalize id
|
32
28
|
end
|
33
29
|
|
34
30
|
# The organization account, obtained from the first component of the id.
|
@@ -56,7 +52,7 @@ module Conjur
|
|
56
52
|
# Splits the id into 3 components, and then joins them with a forward-slash `/`.
|
57
53
|
def to_url_path
|
58
54
|
id.split(':', 3)
|
59
|
-
.map(&method(:
|
55
|
+
.map(&method(:fully_escape))
|
60
56
|
.join('/')
|
61
57
|
end
|
62
58
|
|
@@ -64,5 +60,12 @@ module Conjur
|
|
64
60
|
def to_s
|
65
61
|
id
|
66
62
|
end
|
63
|
+
|
64
|
+
def self.normalize id
|
65
|
+
Array(id).join(':').tap do |id|
|
66
|
+
raise ArgumentError, "id must be fully qualified: #{id}" \
|
67
|
+
unless id =~ /.*:.*:.*/
|
68
|
+
end
|
69
|
+
end
|
67
70
|
end
|
68
71
|
end
|
data/lib/conjur/role_grant.rb
CHANGED
@@ -1,23 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2013-2018 CyberArk Ltd.
|
1
4
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
-
# subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
13
8
|
#
|
14
|
-
#
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
10
|
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
21
17
|
module Conjur
|
22
18
|
# Represents the membership of a role. `RoleGrant`s are returned
|
23
19
|
# by {ActsAsRole#members} and represent members of the role on which the method was invoked.
|
@@ -28,7 +24,6 @@ module Conjur
|
|
28
24
|
#
|
29
25
|
class RoleGrant
|
30
26
|
extend BuildObject::ClassMethods
|
31
|
-
extend Cast
|
32
27
|
|
33
28
|
# The role which was granted.
|
34
29
|
# @return [Conjur::Role]
|