conjur-api 4.25.1 → 4.26.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a4d39e4a78aca87161fdd361e061d8fa61eb103
4
- data.tar.gz: 18c7f65ecd58167229788f3d01ffd55c22198341
3
+ metadata.gz: e955d64cd6ce130071bad4809bfe207dc3fb8b6c
4
+ data.tar.gz: b0f1cf6e8960332a9a06ec806cbb52866bd39ecc
5
5
  SHA512:
6
- metadata.gz: 92e237543b838497692b062f514d3bf17693f82a1705a3527146e262417629c667a3bd5f2c4cf9247eac630bf0985d990a45f31b5d8f1bc93d0e557b1305b2ee
7
- data.tar.gz: ab2049acd3830d358897ab9b3bc4c2450c088c6c94bc8ac7bab5c03fa4ae320b9294d661ca87a1360944ebe95ef8c1f8bbdfd1aa66c65025d60277b1fc633d32
6
+ metadata.gz: 26bf9521c171451e4820aed4636071b735e7876e5b71707377e07e36d450a842d9e627ecd69e2456d8966708b3854c3bfbf9b7a7dea515067007e9ec969862f2
7
+ data.tar.gz: cff05fb02234c561bbbfbf8d7130b48a72c741c9bc80db1d540212d02d7f3334b1abc3fdf72dbe6bc60d14a703713550d7670e5ce2f9e1a3f14814a2c37bef82
@@ -1,3 +1,7 @@
1
+ # v4.26.0
2
+
3
+ * expose admin_option in the role graph (only populated by Conjur 4.8 and later)
4
+
1
5
  # v4.25.1
2
6
 
3
7
  * Fix token refresh when using `with_privilege`, `with_audit_roles`,
data/jenkins.sh CHANGED
@@ -10,7 +10,7 @@ if [ -z "$CONJUR_CONTAINER" ]; then
10
10
  docker pull $DOCKER_IMAGE
11
11
  fi
12
12
 
13
- cid=$(docker run -d -v ${PWD}:/src/conjur-api $DOCKER_IMAGE)
13
+ cid=$(docker run --privileged -d -v ${PWD}:/src/conjur-api $DOCKER_IMAGE)
14
14
  function finish {
15
15
  if [ "$NOKILL" != "1" ]; then
16
16
  docker rm -f ${cid}
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Conjur
21
21
  class API
22
- VERSION = "4.25.1"
22
+ VERSION = "4.26.0"
23
23
  end
24
24
  end
@@ -212,13 +212,19 @@ module Conjur
212
212
  # @return [Conjur::Role] the child role
213
213
  attr_reader :child
214
214
 
215
+ # Was the role granted with admin_option? May be nil if unknown
216
+ # (e.g. if the server doesn't return it).
217
+ attr_reader :admin_option
218
+ alias :admin_option? :admin_option
219
+
215
220
  # Create a directed edge with a parent and child
216
221
  #
217
222
  # @param [Conjur::Role] parent the parent or source of this edge
218
223
  # @param [Conjur::Role] child the child or destination of this edge
219
- def initialize parent, child
224
+ def initialize parent, child, admin_option = nil
220
225
  @parent = parent
221
226
  @child = child
227
+ @admin_option = admin_option
222
228
  end
223
229
 
224
230
  # Serialize this edge as JSON.
@@ -248,20 +254,20 @@ module Conjur
248
254
  # @return [Hash] a Hash representing this edge
249
255
  def to_h
250
256
  # return string keys to make testing less brittle
251
- {'parent' => @parent, 'child' => @child}
257
+ {'parent' => @parent, 'child' => @child}.tap {|h| h['admin_option'] = @admin_option unless @admin_option.nil?}
252
258
  end
253
259
 
254
260
  # Return this edge as an Array like ["parent", "child"]
255
261
  #
256
262
  # @return [Array<String>] the edge as an Array
257
263
  def to_a
258
- [@parent, @child]
264
+ [@parent, @child].tap {|a| a.push(@admin_option) unless @admin_option.nil?}
259
265
  end
260
266
 
261
267
  # @api private
262
268
  # :nodoc:
263
269
  def to_s
264
- "<Edge #{parent.id} --> #{child.id}>"
270
+ "<Edge #{parent.id} --> #{child.id} (admin: #{@admin_option.inspect})>"
265
271
  end
266
272
 
267
273
  # Support using edges as hash keys
@@ -11,13 +11,12 @@ describe Conjur::Graph do
11
11
  ['o', 'q'],
12
12
  ['x', 'o']
13
13
  ]}
14
- let(:hash_graph){ {'graph' => edges} }
15
- let(:json_graph){ hash_graph.to_json }
14
+ let(:edges_with_admin) { edges.each {|e| e.push(false)} }
15
+
16
16
  let(:short_json_graph){ edges.to_json }
17
17
  let(:long_edges){ edges.map{|e| {'parent' => e[0], 'child' => e[1]}} }
18
18
  let(:long_hash_graph){ {'graph' => long_edges} }
19
19
  let(:long_json_graph){ long_hash_graph.to_json }
20
- let(:edge_objects){ edges.map{|e| Conjur::Graph::Edge.new(*e) }}
21
20
 
22
21
  describe "json methods" do
23
22
  subject{described_class.new edges}
@@ -77,9 +76,12 @@ describe Conjur::Graph do
77
76
  end
78
77
  end
79
78
 
80
- describe "Graph.new" do
81
- let(:arg){ edges }
79
+ shared_examples "it creates a new Graph" do
80
+ let(:arg) { graph_edges }
81
+ let(:edge_objects){ graph_edges.map{|e| Conjur::Graph::Edge.new(*e) }}
82
+
82
83
  subject{ described_class.new arg }
84
+
83
85
  def self.it_accepts_the_argument
84
86
  it "accepts the argument" do
85
87
  expect(subject.edges.to_set).to eq(edge_objects.to_set)
@@ -90,13 +92,26 @@ describe Conjur::Graph do
90
92
  end
91
93
 
92
94
  describe "given a hash of {'graph' => <array of edges>}" do
93
- let(:arg){ hash_graph }
95
+ let(:arg){ {'graph' => graph_edges} }
94
96
  it_accepts_the_argument
95
97
  end
96
98
 
97
99
  describe "given a JSON string" do
98
- let(:arg){ json_graph }
100
+ let(:arg){ {'graph' => graph_edges}.to_json }
99
101
  it_accepts_the_argument
100
102
  end
101
103
  end
102
- end
104
+
105
+ describe "Graph.new" do
106
+ it_should_behave_like "it creates a new Graph" do
107
+ let(:graph_edges) { edges }
108
+ end
109
+ end
110
+
111
+ describe "Graph.new with admin_option present" do
112
+ it_should_behave_like "it creates a new Graph" do
113
+ let(:graph_edges) { edges_with_admin }
114
+ end
115
+ end
116
+
117
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.25.1
4
+ version: 4.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafal Rzepecki
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-23 00:00:00.000000000 Z
12
+ date: 2016-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client