ditty 0.7.1 → 0.7.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
  SHA256:
3
- metadata.gz: c15560015979ad1fc7afda1efc7becd871635867ace4fa364f47eb6473baf5e4
4
- data.tar.gz: 2ea52af0c53587b08562f5a594b7f0b951638310f60a4c5ce2ce5ac937e2efbd
3
+ metadata.gz: e259c6108ab65c11c7e5c33bb445406f3c5e172762369ac3fd9acc4055410d72
4
+ data.tar.gz: 0af669878d11300cdf8e0853bfde158f70510ccf4ae390b11910c73fa1856347
5
5
  SHA512:
6
- metadata.gz: 0aa2bd4eb180cf51106d4d645e0effd68a924c866bba915f26526e30d4dfe11d8f800ac32e1779c738e606a39b1a6b003b4039902b43d8a1cde1f2cc2890f9e6
7
- data.tar.gz: 39c61fef5b3fad41838de4903b88e16df4b606bd9249421d2db9ede59ed75855f2bc0936aaf84e1a8dc8cce17a0d966520cffaf50196446f91ba20e165ee8b9e
6
+ metadata.gz: 315f96dba2cc2c6ed416bf23f0f326deccf55bfe27e72c94b51f3001c84c5b8bab0571700c47d981bb23e0b61ab7a62c971653603e1ae2b6df9e0eb926756068
7
+ data.tar.gz: f426c1883a87e955fb5e9dd680f482287438fd101db1ebed3c3a515bdf8cf7d93c5cfc7ccba5b23ce37f70e8a7ccedc54bcc01c592eb19599090a111802e05d6
@@ -62,13 +62,7 @@ module Ditty
62
62
 
63
63
  ::Ditty::Role.find_or_create(name: 'super_admin')
64
64
  ::Ditty::Role.find_or_create(name: 'admin')
65
- user_role = ::Ditty::Role.find_or_create(name: 'user')
66
-
67
- # Anonymous User
68
- anon = ::Ditty::User.find_or_create(email: 'anonymous@ditty.io')
69
- anon.remove_role user_role
70
- anon_role = ::Ditty::Role.find_or_create(name: 'anonymous')
71
- anon.add_role anon_role unless anon.role?('anonymous')
65
+ ::Ditty::Role.find_or_create(name: 'user')
72
66
  end
73
67
  end
74
68
  end
@@ -65,6 +65,14 @@ module Ditty
65
65
  role = ::Ditty::Role.find_or_create(name: 'anonymous')
66
66
  ::Ditty::User.where(roles: role).first
67
67
  end
68
+
69
+ def create_anonymous_user(email = 'anonymous@ditty.io')
70
+ return if anonymous_user
71
+
72
+ user = ::Ditty::User.find_or_create(email: email)
73
+ user.remove_role ::Ditty::Role.find_or_create(name: 'user')
74
+ user.add_role ::Ditty::Role.find_or_create(name: 'anonymous') unless user.role?('anonymous')
75
+ end
68
76
  end
69
77
  end
70
78
  end
data/lib/ditty/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ditty
4
- VERSION = '0.7.1'.freeze
4
+ VERSION = '0.7.2'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ditty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgens du Toit