conjur-cli 4.5.0 → 4.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/conjur/command/roles.rb +4 -2
- data/lib/conjur/version.rb +1 -1
- data/spec/command/roles_spec.rb +15 -0
- metadata +4 -4
data/lib/conjur/command/roles.rb
CHANGED
@@ -89,13 +89,15 @@ class Conjur::Command::Roles < Conjur::Command
|
|
89
89
|
arg_name "role member"
|
90
90
|
command :grant_to do |c|
|
91
91
|
c.desc "Whether to grant with admin option"
|
92
|
-
c.switch :admin
|
92
|
+
c.switch [:a,:admin]
|
93
93
|
|
94
94
|
c.action do |global_options,options,args|
|
95
95
|
id = require_arg(args, 'role')
|
96
96
|
member = require_arg(args, 'member')
|
97
97
|
role = api.role(id)
|
98
|
-
|
98
|
+
grant_options = {}
|
99
|
+
grant_options[:admin_option] = true if options[:admin]
|
100
|
+
role.grant_to member, grant_options
|
99
101
|
puts "Role granted"
|
100
102
|
end
|
101
103
|
end
|
data/lib/conjur/version.rb
CHANGED
data/spec/command/roles_spec.rb
CHANGED
@@ -2,6 +2,21 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Conjur::Command::Roles, logged_in: true do
|
4
4
|
|
5
|
+
describe "role:grant_to" do
|
6
|
+
describe_command "role:grant_to test:a test:b" do
|
7
|
+
it "grants the role without options" do
|
8
|
+
Conjur::Role.any_instance.should_receive(:grant_to).with("test:b", {})
|
9
|
+
invoke
|
10
|
+
end
|
11
|
+
end
|
12
|
+
describe_command "role:grant_to --admin test:a test:b" do
|
13
|
+
it "grants the role with admin option" do
|
14
|
+
Conjur::Role.any_instance.should_receive(:grant_to).with("test:b", {admin_option: true})
|
15
|
+
invoke
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
5
20
|
describe "role:create" do
|
6
21
|
describe_command "role:create test:the-role" do
|
7
22
|
it "creates the role with no options" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conjur-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-01-
|
13
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: conjur-api
|
@@ -291,7 +291,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
291
291
|
version: '0'
|
292
292
|
segments:
|
293
293
|
- 0
|
294
|
-
hash:
|
294
|
+
hash: 2904609356239992395
|
295
295
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
296
296
|
none: false
|
297
297
|
requirements:
|
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
300
|
version: '0'
|
301
301
|
segments:
|
302
302
|
- 0
|
303
|
-
hash:
|
303
|
+
hash: 2904609356239992395
|
304
304
|
requirements: []
|
305
305
|
rubyforge_project:
|
306
306
|
rubygems_version: 1.8.25
|