simple-authorisation 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ module Sinatra
4
4
  module SinatraAuthorisation
5
5
  def self.registered(app)
6
6
  app.set :authorisation_login, '/login'
7
+ app.set :authorisation_permission_denied, '/403'
7
8
  app.set :authorisation_current_user, :current_user
8
9
  app.set :authorisation_anonymous_user_class, NilClass
9
10
 
@@ -16,10 +17,18 @@ module Sinatra
16
17
  :anonymous_user_class => options.authorisation_anonymous_user_class,
17
18
  :method => request.request_method.downcase.to_sym)
18
19
  session[:return_to] = request.fullpath unless request.fullpath.include?('favicon.ico')
19
- redirect options.authorisation_login
20
- return false
20
+
21
+ if user.is_a? options.authorisation_anonymous_user_class
22
+ redirect options.authorisation_login
23
+ else
24
+ redirect options.authorisation_permission_denied
25
+ end
21
26
  end
22
27
  end
28
+
29
+ app.get '/403' do
30
+ "The action you have tried to perform is not available"
31
+ end
23
32
  end
24
33
 
25
34
  end
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'simple-authorisation'
6
- s.version = '0.0.5'
6
+ s.version = '0.0.6'
7
7
  s.authors = ["Derek Ekins"]
8
8
  s.description = 'Handles authorisation only'
9
9
  s.summary = "simple-authorisation-#{s.version}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-authorisation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &11355540 !ruby/object:Gem::Requirement
16
+ requirement: &21871320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *11355540
24
+ version_requirements: *21871320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &11355060 !ruby/object:Gem::Requirement
27
+ requirement: &21870840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *11355060
35
+ version_requirements: *21870840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &11354600 !ruby/object:Gem::Requirement
38
+ requirement: &21870380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.6.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *11354600
46
+ version_requirements: *21870380
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sinatra
49
- requirement: &11354140 !ruby/object:Gem::Requirement
49
+ requirement: &21869920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.2.6
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *11354140
57
+ version_requirements: *21869920
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &11353680 !ruby/object:Gem::Requirement
60
+ requirement: &21869460 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.6.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *11353680
68
+ version_requirements: *21869460
69
69
  description: Handles authorisation only
70
70
  email: derek@spathi.com
71
71
  executables: []
@@ -117,7 +117,7 @@ rubyforge_project:
117
117
  rubygems_version: 1.8.6
118
118
  signing_key:
119
119
  specification_version: 3
120
- summary: simple-authorisation-0.0.5
120
+ summary: simple-authorisation-0.0.6
121
121
  test_files:
122
122
  - spec/simple-authorisation/authorisation_spec.rb
123
123
  - spec/simple-authorisation/sinatra_integration_spec.rb