selfsdk 0.0.173 → 0.0.174
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acl.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c5f337bf8029e978de8dfc0e81f9689f34ce7c746db0ee49da981a48f621a33
|
4
|
+
data.tar.gz: baf4784345f281cfda38d86e9a24a5f2c8f1991f587696ac6d2e655ce379a02c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11161a22d7e15e23e85e4871fd10bb5ee501f5ace89046f5155c897e58b4384a64dcdfcfb1b9869009fa40ff017370b6740c89073805a66fe852226de1e10e1f
|
7
|
+
data.tar.gz: 025fb47e5b70062d7c861bba26084d6ffdfd953a5eebf496066da3f3358e670e7b7a5fcbbffa0bb012d6dded72b8530b9276d625f5b41c9bd661b7c5b7654b31
|
data/lib/acl.rb
CHANGED
@@ -11,16 +11,19 @@ module SelfSDK
|
|
11
11
|
def initialize(messaging)
|
12
12
|
@messaging = messaging
|
13
13
|
@jwt = @messaging.jwt
|
14
|
+
@acl_rules = []
|
14
15
|
end
|
15
16
|
|
16
17
|
# Lists allowed connections.
|
17
18
|
def list
|
18
19
|
SelfSDK.logger.info "Listing allowed connections"
|
19
|
-
@messaging.list_acl_rules
|
20
|
+
@acl_rules = @messaging.list_acl_rules if @acl_rules.empty?
|
21
|
+
@acl_rules
|
20
22
|
end
|
21
23
|
|
22
24
|
# Allows incomming messages from the given identity.
|
23
25
|
def allow(id)
|
26
|
+
@acl_rules << id
|
24
27
|
SelfSDK.logger.info "Allowing connections from #{id}"
|
25
28
|
@messaging.add_acl_rule(@jwt.prepare(jti: SecureRandom.uuid,
|
26
29
|
cid: SecureRandom.uuid,
|
@@ -35,6 +38,7 @@ module SelfSDK
|
|
35
38
|
|
36
39
|
# Deny incomming messages from the given identity.
|
37
40
|
def deny(id)
|
41
|
+
@acl_rules.delete(id)
|
38
42
|
SelfSDK.logger.info "Denying connections from #{id}"
|
39
43
|
@messaging.remove_acl_rule(@jwt.prepare(jti: SecureRandom.uuid,
|
40
44
|
cid: SecureRandom.uuid,
|