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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39b69eb5eec382500250f033e5156e8a92e4811cbb865976d6dc69b43def1a40
4
- data.tar.gz: 4c6b62aa93fcf6ed3cb28f4cc8f4539fc58b6a11c4654e9bfa5dc21b871b0d08
3
+ metadata.gz: 4fc23c86e73dc266b4778000012b7fac48fa54baa55634d2b2624d55d9087626
4
+ data.tar.gz: c9f3ed1dbf225c237364d3a4df99551eb4f4e82b0032f246a743e9e05a7b5c88
5
5
  SHA512:
6
- metadata.gz: 6f9a6e102780769e7b76f3ce3cd017d2e60f4346ad9cfbfbf372791b7e377c8d37968437c355b6cf5127604a66ad663615d789f894030c8aa297b476c7397824
7
- data.tar.gz: fb197f8b37e7ed3330803ef58c0b78945f963308c411ba403777b9b06340f555600f466b408f89b2f39962e68d3e1e5451b1749273704c773f6440fbbeda525c
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
- json result
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
@@ -1,3 +1,3 @@
1
1
  module Menilite
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
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.6
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-08 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler