menilite 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/menilite/server/privilege.rb +9 -0
- data/lib/menilite/server/router.rb +7 -1
- data/lib/menilite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fc23c86e73dc266b4778000012b7fac48fa54baa55634d2b2624d55d9087626
|
4
|
+
data.tar.gz: c9f3ed1dbf225c237364d3a4df99551eb4f4e82b0032f246a743e9e05a7b5c88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d038488bf0af42feddac643a53823cb1ea5ba9166d143ff919d2f5bba1aa8e2296fa18216a9b33bba8f23f0a7b8ce78ca89c8031f19d27082ef6d4ed736a6a7
|
7
|
+
data.tar.gz: 2baf9395816f90d34ac6ee43db0a6209c18ea65be726e704908bd3aa1a7e5d8cc1dfa0f19539dc85624399735ef5f62e7d350e44a4f5f67bdb52470759d935ad
|
@@ -23,12 +23,21 @@ module Menilite
|
|
23
23
|
def self.init
|
24
24
|
instance = PrivilegeService.new
|
25
25
|
Thread.current.thread_variable_set(:previlege_service, instance)
|
26
|
+
@disable = false
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.current
|
30
|
+
return nil if @disable
|
29
31
|
Thread.current.thread_variable_get(:previlege_service)
|
30
32
|
end
|
31
33
|
|
34
|
+
def self.disable(&block)
|
35
|
+
@disable = true
|
36
|
+
block.call
|
37
|
+
ensure
|
38
|
+
@disable = false
|
39
|
+
end
|
40
|
+
|
32
41
|
def get_privileges(names)
|
33
42
|
names.map{|key| @privileges.find{|p| p.key == key } }.compact
|
34
43
|
end
|
@@ -144,7 +144,13 @@ module Menilite
|
|
144
144
|
else
|
145
145
|
klass[params[:id]].send(action.name, *data["args"])
|
146
146
|
end
|
147
|
-
|
147
|
+
if result.kind_of?(Menilite::Model)
|
148
|
+
json Serializer.serialize(result)
|
149
|
+
elsif result.is_a?(Array)
|
150
|
+
json result.map{|x| x.kind_of?(Menilite::Model) ? Serializer.serialize(x) : x }
|
151
|
+
else
|
152
|
+
json result
|
153
|
+
end
|
148
154
|
end
|
149
155
|
end
|
150
156
|
end
|
data/lib/menilite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: menilite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|