auth-lh 1.0 → 1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb4241bf40e9b6644cbb77638cf083fe9161a675
4
- data.tar.gz: de2e76baef61b694fca69931cc30866d13909b96
3
+ metadata.gz: cfc693ec109e5833dfdf0160468aedb3461cfe26
4
+ data.tar.gz: 9a3dcfc0bf903023cb76ea0c5a3d294e5472d040
5
5
  SHA512:
6
- metadata.gz: 58b3ca6c33c947982634c3b64a81c02c57d0055449c51eb55fa96facba9ee3041049e1fdd62f6a3d35a1c07b6f713d08a884a8fbdbe135726714816e371f1d50
7
- data.tar.gz: aa3115b2f40894959d9bc1ceb695bb000a0db91ed82995a0bc784b4126f68eee73a391ed85a737d3a6ed2a71bafe9e1ba3b5f7939304c846cff6fcdfb9a33c5e
6
+ metadata.gz: 58682a91bebc3acb3920d1adb717d3603b8e1c22e3ba7fb000a0d3a2f31a501956acc4709edb88286bd307d9551c692a94d92ae054b010fa0451d8ec3e348991
7
+ data.tar.gz: cb367069adbb1508370ec4e9e4b64f3ede17ec3b2c2e3bdccd9ed6f947f21063e9ac1fd5b7d97acbc3144de415452b40a5eb420d5a476ee04416ffce72dd8ced
data/CHANGELOG.md CHANGED
@@ -265,3 +265,7 @@
265
265
  ## v1.0
266
266
 
267
267
  * Refactor on auth, static methods moved to class, added module for authentication.
268
+
269
+ ## v1.1
270
+
271
+ * Added method to check local access.
@@ -1,5 +1,5 @@
1
1
  module Auth
2
2
  module Lh
3
- VERSION = "1.0"
3
+ VERSION = '1.1'
4
4
  end
5
5
  end
@@ -25,6 +25,16 @@ module AuthLh
25
25
  @current_shop
26
26
  end
27
27
 
28
+ def check_local_access
29
+ if current_user
30
+ allowed_shop_codes = current_user.allowed_local_shop_codes(current_shop.try(:code))
31
+
32
+ if !allowed_shop_codes.include?(local_shop.code)
33
+ render file: 'public/403.html', layout: false
34
+ end
35
+ end
36
+ end
37
+
28
38
  def check_access_grants
29
39
  if current_user
30
40
  if !current_user.can_access?(params[:controller], params[:action])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth-lh
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-12 00:00:00.000000000 Z
11
+ date: 2017-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler