guachiman 0.1.5 → 0.1.6

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: 9bb434953ea5c8ab561240736018d69cae694358
4
- data.tar.gz: e3842d89ba4ddb628c6bd0d65ca21f539ebd9e9b
3
+ metadata.gz: cf093d276a4515a2f1c3112adddd138ce7bceb49
4
+ data.tar.gz: b2e0db7423f35752ab8d23a5548bc56501a56bd6
5
5
  SHA512:
6
- metadata.gz: 91d00a9cd7e4cf285dd466ccb265074b46872a966b5bd20afb7ced75fa305de79a0f60d194ab0f61b5c9c165459a989f00364eaad25e66a2bfeedf8d40c00f8d
7
- data.tar.gz: c2573c47d188a6ad7f9c3e90ca9bd5316b8be9b26f044c73c2886c9ca288b46fc810af13f5aa6c5a1261a27a51c283b7a86d1a7149755d5213110d1f66cdfed9
6
+ metadata.gz: cccdb77e8e77682be8fb2ff70468f963c443e236df50229f7221b0cd9cabc97e9351089d87bb0fd6319b5465ad9fa465ba819911d9fc3fa755c1a09eed9770c6
7
+ data.tar.gz: 37c4a59caceb7b68a8dabf9a97ae4bafce9d6acc5cd51a871612a497ca5165b7429e8c6e92c6e544da5e83b4c6d1aa555dcdc7660aedde5dbf7d2ea72275cd56
@@ -24,10 +24,10 @@ module Guachiman
24
24
  if current_permission.allow? controller_name, action_name, current_resource
25
25
  current_permission.permit_params! params
26
26
  else
27
- if current_user
28
- not_authorized
27
+ if request.get?
28
+ current_user ? not_authorized : not_signed_in
29
29
  else
30
- not_signed_in
30
+ render_unauthorized
31
31
  end
32
32
  end
33
33
  end
@@ -40,5 +40,9 @@ module Guachiman
40
40
  session[:next] = request.url
41
41
  redirect_to sign_in_path, alert: t('flashes.please_sign_in')
42
42
  end
43
+
44
+ def render_unauthorized
45
+ render text: "NO", status: :unauthorized
46
+ end
43
47
  end
44
48
  end
@@ -1,3 +1,3 @@
1
1
  module Guachiman
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
@@ -21,10 +21,10 @@ class InstallGeneratorTest < Rails::Generators::TestCase
21
21
  run_generator
22
22
 
23
23
  assert_file 'app/models/permission.rb' do |f|
24
- assert_match /class Permission/, f
25
- assert_match /include Guachiman::Permissions/, f
26
- assert_match /include Guachiman::Params/, f
27
- assert_match /initialize current_user/, f
24
+ assert_match(/class Permission/, f)
25
+ assert_match(/include Guachiman::Permissions/, f)
26
+ assert_match(/include Guachiman::Params/, f)
27
+ assert_match(/initialize current_user/, f)
28
28
  end
29
29
  end
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guachiman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Rodriguez
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-05 00:00:00.000000000 Z
12
+ date: 2013-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties