bsm-rails-api 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 8a942ceff62e17de023a3e4fd5ef334080410bdb
4
- data.tar.gz: 79d9c3f85caa0102c788faad1f3ef13919b1f052
3
+ metadata.gz: 732b21fdc3472d8d5f910950590adfd64060776d
4
+ data.tar.gz: 909dd536083ed3e566dd38e398c804991214618f
5
5
  SHA512:
6
- metadata.gz: 1559658a1ff562820e1d35137543bfaeb4ca9766c5a643300db783b426db50bb2c6eccca4b07eeffb5747e027076a7d6a1ccb88d902430a76f1bce4995c880bc
7
- data.tar.gz: b4208dce344117e471e9717c849023804292891ca284597a006e71ab8b6b2af38607e695adb94944fedf6372ad85826faa53c028a5a0b5e8c4486cd7a3c13d38
6
+ metadata.gz: 7723109485f1ace328add3c0da5ff08e64b9f60fc4b0f601d639cc1d0e1f98a1186f05d71d6b934289620de5bcb1c69509b34b9aeb9214f957507b34151cf070
7
+ data.tar.gz: 6c7251612573ffdb4e0aab872bd9c2ade5815f24872ec56a67f798b2589c78d02c6b7a47cf52af4954fe4077b0b166dec8c624162f3e204ccfcd1bc98be55080
@@ -1,3 +1,5 @@
1
+ require 'active_support/concern'
2
+
1
3
  module BSM
2
4
  module RailsAPI
3
5
  end
@@ -1,5 +1,3 @@
1
- require 'active_support/concern'
2
-
3
1
  module BSM::RailsAPI::Authorization
4
2
  extend ActiveSupport::Concern
5
3
 
@@ -36,11 +34,12 @@ module BSM::RailsAPI::Authorization
36
34
  end.flatten.uniq
37
35
 
38
36
  before_action only: acts do |ctrl|
39
- user = ctrl.send(:current_user)
40
- ctrl.send :unauthorized! unless user
41
-
42
- reqs = opts[user.kind.to_sym]
43
- ctrl.send :unauthorized! if reqs != :all && (Array.wrap(reqs) & user.roles).empty?
37
+ if user = ctrl.send(:current_user)
38
+ reqs = opts[user.kind.to_sym]
39
+ ctrl.send :unauthorized! if reqs != :all && (Array.wrap(reqs) & user.roles).empty?
40
+ else
41
+ ctrl.send :unauthorized!
42
+ end
44
43
  ctrl.send :instance_variable_set, :@_bsm_rails_api_authorized, true
45
44
  end unless acts.empty?
46
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsm-rails-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko