mumukit-auth 3.5.1 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/auth/permissions_persistence/daybreak.rb +29 -0
- data/lib/mumukit/auth/store.rb +13 -12
- data/lib/mumukit/auth/version.rb +1 -1
- data/lib/mumukit/auth.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b90f8c34b943bbdf1d0437289ba6d104498defcd
|
4
|
+
data.tar.gz: fc136b27740aaf81f7a8bd650464e97f17b62a70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a034e8d1af30290a1c6626d81c8bc32316ced3126f850c0ed9f8b364d895bfd207d4c869933f99818957a4b7a274ade3a946448e350144da6d52613e5f8280d
|
7
|
+
data.tar.gz: 8f08e07b29237cf34e54e324961d1f5b31c192e0a23f49cfe45b1de90f9cf9146e33afbd244d5808e221cf51103e0d9d8cb4d72293fbea8063f29e216c944096
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Mumukit::Auth
|
2
|
+
module PermissionsPersistence
|
3
|
+
class Daybreak
|
4
|
+
def self.from_config
|
5
|
+
new Mumukit::Auth.config.daybreak_name
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(db_name)
|
9
|
+
@db = ::Daybreak::DB.new "#{db_name}.db", default: '{}'
|
10
|
+
end
|
11
|
+
|
12
|
+
def close
|
13
|
+
@db.close
|
14
|
+
end
|
15
|
+
|
16
|
+
def set!(key, value)
|
17
|
+
@db.update! key.to_sym => value.to_json
|
18
|
+
end
|
19
|
+
|
20
|
+
def get(key)
|
21
|
+
Mumukit::Auth::Permissions.load @db[key]
|
22
|
+
end
|
23
|
+
|
24
|
+
def clean_env!
|
25
|
+
FileUtils.rm ["#{Mumukit::Auth.config.daybreak_name}.db"], force: true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/mumukit/auth/store.rb
CHANGED
@@ -1,32 +1,33 @@
|
|
1
1
|
module Mumukit::Auth
|
2
2
|
class Store
|
3
|
-
def initialize
|
4
|
-
@db =
|
5
|
-
end
|
6
|
-
|
7
|
-
def close
|
8
|
-
@db.close
|
3
|
+
def initialize
|
4
|
+
@db = Mumukit::Auth.config.persistence_strategy
|
9
5
|
end
|
10
6
|
|
11
7
|
def set!(key, value)
|
12
|
-
@db.
|
8
|
+
@db.set! key.to_sym, value
|
13
9
|
end
|
14
10
|
|
15
11
|
def get(key)
|
16
|
-
|
12
|
+
@db.get key
|
13
|
+
end
|
14
|
+
|
15
|
+
def clean_env!
|
16
|
+
@db.clean_env!
|
17
17
|
end
|
18
18
|
|
19
19
|
class << self
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
def from_config
|
22
|
+
Mumukit::Auth.config.persistence_strategy.class.from_config
|
22
23
|
end
|
23
24
|
|
24
25
|
def clean_env!
|
25
|
-
|
26
|
+
from_config.clean_env!
|
26
27
|
end
|
27
28
|
|
28
29
|
def with(&block)
|
29
|
-
store =
|
30
|
+
store = from_config
|
30
31
|
block.call store
|
31
32
|
ensure
|
32
33
|
store.close
|
data/lib/mumukit/auth/version.rb
CHANGED
data/lib/mumukit/auth.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/mumukit/auth/exceptions.rb
|
107
107
|
- lib/mumukit/auth/grant.rb
|
108
108
|
- lib/mumukit/auth/permissions.rb
|
109
|
+
- lib/mumukit/auth/permissions_persistence/daybreak.rb
|
109
110
|
- lib/mumukit/auth/role.rb
|
110
111
|
- lib/mumukit/auth/roles.rb
|
111
112
|
- lib/mumukit/auth/scope.rb
|