ditty 0.7.0 → 0.7.1

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: 16ed8ef74d24cd5afd39d1cf3b5fc396d317809f56b4968b51433193202a9716
4
- data.tar.gz: a8a21a36396f59a455613c21541974a26b4eaf0fbadc21bb3899ff720bf9c356
3
+ metadata.gz: c15560015979ad1fc7afda1efc7becd871635867ace4fa364f47eb6473baf5e4
4
+ data.tar.gz: 2ea52af0c53587b08562f5a594b7f0b951638310f60a4c5ce2ce5ac937e2efbd
5
5
  SHA512:
6
- metadata.gz: ef3c10b9867a2c2077ecf2cea14462ec32d811db7d83625fdba64aac5b8016da2e8276f0b14cb52d1f5ebe74e5b0a10191e28542c088d498da3538ad3581baab
7
- data.tar.gz: 1d87b3e5aaa54320259e0031215a6cdd4d41b5ebbf9eef8d349fdd3c2cbb75d42da529b65a9f36aee3aa50aaf8f60379b435d14abfae4cd0621a525aa80c4926
6
+ metadata.gz: 0aa2bd4eb180cf51106d4d645e0effd68a924c866bba915f26526e30d4dfe11d8f800ac32e1779c738e606a39b1a6b003b4039902b43d8a1cde1f2cc2890f9e6
7
+ data.tar.gz: 39c61fef5b3fad41838de4903b88e16df4b606bd9249421d2db9ede59ed75855f2bc0936aaf84e1a8dc8cce17a0d966520cffaf50196446f91ba20e165ee8b9e
@@ -8,7 +8,7 @@ module Ditty
8
8
  module Helpers
9
9
  module Authentication
10
10
  def current_user
11
- return anonymous_user if current_user_id.nil?
11
+ return nil if current_user_id.nil?
12
12
  @current_user ||= User[current_user_id]
13
13
  end
14
14
 
@@ -40,11 +40,6 @@ module Ditty
40
40
  env['rack.session'].delete('user_id') unless env['rack.session'].nil?
41
41
  env.delete('omniauth.auth')
42
42
  end
43
-
44
- def anonymous_user
45
- role = ::Ditty::Role.where(name: 'anonymous').first
46
- ::Ditty::User.where(roles: role).first unless role.nil?
47
- end
48
43
  end
49
44
 
50
45
  class NotAuthenticated < StandardError
@@ -59,5 +59,12 @@ module Ditty
59
59
  def username
60
60
  identity_dataset.first.username
61
61
  end
62
+
63
+ class << self
64
+ def anonymous_user
65
+ role = ::Ditty::Role.find_or_create(name: 'anonymous')
66
+ ::Ditty::User.where(roles: role).first
67
+ end
68
+ end
62
69
  end
63
70
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ditty
4
- VERSION = '0.7.0'.freeze
4
+ VERSION = '0.7.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ditty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgens du Toit
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-30 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler