rs_user_policy 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.rdoc +1 -0
- data/bin/rs_user_policy +10 -2
- data/lib/rs_user_policy/audit_log.rb +15 -2
- data/lib/rs_user_policy/user_assignments/json_user_assignments.rb +1 -4
- metadata +9 -21
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Y2FhODMxNzIwNjgwYmE3Y2UzOGZhZDUwNzNlMzU4N2NmM2U5ZGNhYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzNiMTRjYmM0N2Y1ZDI4NGEwYThmNGY5ZDc0Zjc5MmQyY2MzYWRjMQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Nzk5N2I2MDk4NDg5YzUwMGRjMWMzMWRmNDZjNDFkZGEwYjgyNmFkNTQ1OGU5
|
10
|
+
MmJkZTFkNTM1YTM2YjY2ZmNjZTM3MmE3MDdkZGJlY2E1NmY1MDcyNTY1ZDdk
|
11
|
+
MzgyZTNkYjA0YmE3YWM3ZjlkYTczYWIxNjhlOWM4YzQ0NWI5NmE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTVhYjg5OGJjMzJlM2QzMzJjMWVjYzllNDgyYjcwMWM2YTYyNzNkZTE3ODdm
|
14
|
+
MTM2NTY2ODlhZmIzMjBjNzNhZTFlMDVlYmZhODMyYWUyZGQ3ZWNiYWM4YjY4
|
15
|
+
N2QzMjgwNmExYTYwMzJjMWZjZDdhMzNiMjc3YzJhODdhYWMyMWE=
|
data/README.rdoc
CHANGED
@@ -135,6 +135,7 @@ Second is the user_assignments-<timestamp>.json file. This will be a combinatio
|
|
135
135
|
* Perhaps allow a role to inherit from another, or be a concatenation of several?
|
136
136
|
* Provide a mechanism for "temporary" users with an expiration date
|
137
137
|
* Perhaps allow the user to enter a different role after the expiration date, rather than being removed completely?
|
138
|
+
* Optionally bail out when provided user_assignments file cannot be parsed. bin/rs_user_policy:75
|
138
139
|
|
139
140
|
== Copyright
|
140
141
|
|
data/bin/rs_user_policy
CHANGED
@@ -46,6 +46,8 @@ opts = Trollop::options do
|
|
46
46
|
opt :rs_acct_num, "A RightScale Enterprise Master Account ID", :type => :string, :multi => true, :required => true
|
47
47
|
opt :policy, "The path to a JSON file containing the role to permissions policy to enforce", :type => :string, :required => true
|
48
48
|
opt :user_assignments, "The path to a JSON file containing email address => role pairs for user assignments", :type => :string
|
49
|
+
opt :empty_user_assignments_fatal, "A flag which asserts that the provided user_assigments should contain at least one user_assignment mapping. If there are 0 user assignments found, rs_user_policy will terminate."
|
50
|
+
opt :audit_dir, "A directory where audit logs will be stored. By default this is the current working directory.", :type => :string
|
49
51
|
opt :dry_run, "A flag indicating that no changes should be made, only the user_assignments.json should be evaluated (or created) and the audit_log.json produced"
|
50
52
|
opt :authority, "A flag indicating that all users in the user_assignments file \"MUST\" exist, and will always be created. Effectively asserting that the user_assignments is your canonical authority for users."
|
51
53
|
end
|
@@ -72,7 +74,13 @@ end
|
|
72
74
|
user_assignments_options = opts[:user_assignments] ? { :filename => opts[:user_assignments] } : {}
|
73
75
|
user_assignments = RsUserPolicy::UserAssignments::JsonUserAssignments.new(user_assignments_options)
|
74
76
|
if user_assignments.length == 0
|
75
|
-
|
77
|
+
if(opts[:empty_user_assignments_fatal])
|
78
|
+
log.fatal("There were 0 user_assigments from filename #{opts[:user_assigments]}. Exitting due to empty_user_assigments_fatal being set.")
|
79
|
+
exit 1
|
80
|
+
else
|
81
|
+
log.warn("No user_assignments file was specified or the file could not be found. All users will be treated as immutable and written to the user_assigments output file.")
|
82
|
+
end
|
83
|
+
|
76
84
|
end
|
77
85
|
|
78
86
|
user_collection = RsUserPolicy::UserCollection.new
|
@@ -187,4 +195,4 @@ end unless opts[:dry_run]
|
|
187
195
|
user_assignments.serialize(:filename => user_assignments_output)
|
188
196
|
audit_log.write_file
|
189
197
|
|
190
|
-
exit exit_code
|
198
|
+
exit exit_code
|
@@ -29,10 +29,23 @@ module RsUserPolicy
|
|
29
29
|
# @param [Hash] options A hash of options that impact the audit log filename.
|
30
30
|
# @option options [String] :timestamp The timestamp to append to the filename
|
31
31
|
# @option options [Bool] :dry_run A boolean indicating if this is a dry run
|
32
|
+
# @option options [String] :audit_dir The directory where the audit log should be created
|
32
33
|
def initialize(options={})
|
33
34
|
timestamp = options[:timestamp] || Time.now.to_i
|
34
35
|
@audit_log = {}
|
35
|
-
@filename =
|
36
|
+
@filename = ''
|
37
|
+
|
38
|
+
if options[:audit_dir]
|
39
|
+
@filename << ::File.join(options[:audit_dir], 'audit_log')
|
40
|
+
else
|
41
|
+
@filename << 'audit_log'
|
42
|
+
end
|
43
|
+
|
44
|
+
if options[:dry_run]
|
45
|
+
@filename << '_dryrun'
|
46
|
+
end
|
47
|
+
|
48
|
+
@filename << "-#{timestamp}.json"
|
36
49
|
end
|
37
50
|
|
38
51
|
# Adds a new entry to the audit log
|
@@ -56,4 +69,4 @@ module RsUserPolicy
|
|
56
69
|
File.open(@filename, 'w') {|f| f.write(JSON.pretty_generate(@audit_log))}
|
57
70
|
end
|
58
71
|
end
|
59
|
-
end
|
72
|
+
end
|
@@ -36,9 +36,6 @@ module RsUserPolicy
|
|
36
36
|
# @option options [Hash] :json A hash containing the user assignments
|
37
37
|
# @option options [String] :json_str A JSON string containing the user assignments
|
38
38
|
# @option options [String] :filename Path and filename to a file containing the user assignments in JSON
|
39
|
-
#
|
40
|
-
# @raise [Errno::ENOENT] If :filename was specified but the policy file does not exist
|
41
|
-
# @raise [JSON::ParserError] If the policy is not valid JSON
|
42
39
|
def initialize(options={})
|
43
40
|
begin
|
44
41
|
if options.has_key?(:json)
|
@@ -140,4 +137,4 @@ module RsUserPolicy
|
|
140
137
|
end
|
141
138
|
end
|
142
139
|
end
|
143
|
-
end
|
140
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rs_user_policy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.10
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ryan J. Geyer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: right_api_client
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: trollop
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -41,7 +37,6 @@ dependencies:
|
|
41
37
|
type: :runtime
|
42
38
|
prerelease: false
|
43
39
|
version_requirements: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
40
|
requirements:
|
46
41
|
- - ! '>='
|
47
42
|
- !ruby/object:Gem::Version
|
@@ -57,6 +52,10 @@ executables:
|
|
57
52
|
extensions: []
|
58
53
|
extra_rdoc_files: []
|
59
54
|
files:
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.rdoc
|
57
|
+
- bin/rs_user_policy
|
58
|
+
- lib/rs_user_policy.rb
|
60
59
|
- lib/rs_user_policy/audit_log.rb
|
61
60
|
- lib/rs_user_policy/policy/json_policy.rb
|
62
61
|
- lib/rs_user_policy/policy/policy.rb
|
@@ -67,40 +66,29 @@ files:
|
|
67
66
|
- lib/rs_user_policy/user_assignments/user_assignments.rb
|
68
67
|
- lib/rs_user_policy/user_collection.rb
|
69
68
|
- lib/rs_user_policy/utilities.rb
|
70
|
-
- lib/rs_user_policy.rb
|
71
|
-
- bin/rs_user_policy
|
72
|
-
- LICENSE.txt
|
73
|
-
- README.rdoc
|
74
69
|
homepage: https://github.com/rgeyer/rs_user_policy
|
75
70
|
licenses:
|
76
71
|
- MIT
|
72
|
+
metadata: {}
|
77
73
|
post_install_message:
|
78
74
|
rdoc_options: []
|
79
75
|
require_paths:
|
80
76
|
- lib
|
81
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
78
|
requirements:
|
84
79
|
- - ! '>='
|
85
80
|
- !ruby/object:Gem::Version
|
86
81
|
version: '0'
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
hash: 1521006983899305700
|
90
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
83
|
requirements:
|
93
84
|
- - ! '>='
|
94
85
|
- !ruby/object:Gem::Version
|
95
86
|
version: '0'
|
96
|
-
segments:
|
97
|
-
- 0
|
98
|
-
hash: 1521006983899305700
|
99
87
|
requirements: []
|
100
88
|
rubyforge_project:
|
101
|
-
rubygems_version:
|
89
|
+
rubygems_version: 2.2.2
|
102
90
|
signing_key:
|
103
|
-
specification_version:
|
91
|
+
specification_version: 4
|
104
92
|
summary: Manages users across many different child accounts of a RightScale Enterprise
|
105
93
|
Master Account
|
106
94
|
test_files: []
|