posgra 0.2.0 → 0.2.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/lib/posgra/client.rb +12 -4
- data/lib/posgra/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7699e01200f7d2fbdcfa86475e043006232704b
|
|
4
|
+
data.tar.gz: ba40659f955f5ecbad1d7bdf2c77a2ddd0fc0c22
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3578e487660aee0766daf01e4fab417c1152bd365c865c92f8c42fd570adc071d6caed97a243a18352e823aadddeeb470f406d1ec16d1c75899e3d00e2f71273
|
|
7
|
+
data.tar.gz: af6242d2e114e350884b673005ae3fd34a37416e70df0586b9465fdcb6f5d74b302f229f0ca04a6591c165908c84a9b84a603447915eda2f317da754d03ad33d
|
data/lib/posgra/client.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
class Posgra::Client
|
|
2
|
+
include Posgra::Utils::Helper
|
|
3
|
+
|
|
2
4
|
DEFAULT_EXCLUDE_SCHEMA = /\A(?:pg_.*|information_schema)\z/
|
|
3
5
|
DEFAULT_EXCLUDE_ROLE = /\A\z/
|
|
4
6
|
DEFAULT_EXCLUDE_DATABASE = /\A(?:template\d+|postgres)\z/
|
|
@@ -144,14 +146,20 @@ class Posgra::Client
|
|
|
144
146
|
|
|
145
147
|
actual.reject {|group, _|
|
|
146
148
|
expected.has_key?(group)
|
|
147
|
-
}.each {|group,
|
|
148
|
-
|
|
149
|
+
}.each {|group, actual_users|
|
|
150
|
+
if matched?(group, @options[:include_role], @options[:exclude_role])
|
|
151
|
+
updated = @driver.drop_group(group) || updated
|
|
152
|
+
else
|
|
153
|
+
actual_users.each do |user|
|
|
154
|
+
updated = @driver.drop_user_from_group(user, group) || updated
|
|
155
|
+
end
|
|
156
|
+
end
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
updated
|
|
152
160
|
end
|
|
153
161
|
|
|
154
|
-
def walk_groups(expected, actual,
|
|
162
|
+
def walk_groups(expected, actual, current_users)
|
|
155
163
|
updated = false
|
|
156
164
|
|
|
157
165
|
expected.each do |expected_group, expected_users|
|
|
@@ -167,7 +175,7 @@ class Posgra::Client
|
|
|
167
175
|
end
|
|
168
176
|
|
|
169
177
|
(actual_users - expected_users).each do |user|
|
|
170
|
-
if
|
|
178
|
+
if current_users.include?(user)
|
|
171
179
|
updated = @driver.drop_user_from_group(user, expected_group) || updated
|
|
172
180
|
end
|
|
173
181
|
end
|
data/lib/posgra/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: posgra
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- winebarrel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pg
|