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 +4 -4
- data/lib/ditty/components/app.rb +1 -7
- data/lib/ditty/models/user.rb +8 -0
- data/lib/ditty/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e259c6108ab65c11c7e5c33bb445406f3c5e172762369ac3fd9acc4055410d72
|
4
|
+
data.tar.gz: 0af669878d11300cdf8e0853bfde158f70510ccf4ae390b11910c73fa1856347
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 315f96dba2cc2c6ed416bf23f0f326deccf55bfe27e72c94b51f3001c84c5b8bab0571700c47d981bb23e0b61ab7a62c971653603e1ae2b6df9e0eb926756068
|
7
|
+
data.tar.gz: f426c1883a87e955fb5e9dd680f482287438fd101db1ebed3c3a515bdf8cf7d93c5cfc7ccba5b23ce37f70e8a7ccedc54bcc01c592eb19599090a111802e05d6
|
data/lib/ditty/components/app.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/ditty/models/user.rb
CHANGED
@@ -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