g5_authenticatable 1.1.2.rc.3 → 1.1.2.rc.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/policies/g5_authenticatable/base_policy.rb +7 -17
- data/lib/g5_authenticatable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5325487f08e32770f5497a9f4da647a8e647705deaf5fe1198ee6b3a7ad5c41
|
4
|
+
data.tar.gz: fba91fae9ef553b86b88b47dbc88b44c855f01af6d9c300a9ed0e06c4f98a489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc7f72bbf54984b3b29679caede77244f3881a680a12eb9eedebe5175f82a199802c3da4085b33093740f97f06b01dd674a8218fbfd4ac0844ca32c19f408efa
|
7
|
+
data.tar.gz: ab97898359cc1c93f809722d221ac7b716069fb4c58173c2f1cea3fe08ff823e9783b5754326b7b5264aa54fe8f32f592b90aa932e276543e854a5fdd7fbe6d9
|
@@ -71,26 +71,16 @@ module G5Authenticatable
|
|
71
71
|
user.present? && user.has_role?(:super_admin)
|
72
72
|
end
|
73
73
|
|
74
|
-
def
|
75
|
-
|
76
|
-
query = user.roles.where(name: role_name)
|
77
|
-
query = query.where(resource_type: nil) if global_scope
|
78
|
-
return query.exists?
|
79
|
-
else
|
80
|
-
return false
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def admin?(global_scope=false)
|
85
|
-
check_for_role(:admin,global_scope)
|
74
|
+
def admin?
|
75
|
+
user.present? && user.has_role?(:admin)
|
86
76
|
end
|
87
77
|
|
88
|
-
def editor?
|
89
|
-
|
78
|
+
def editor?
|
79
|
+
user.present? && user.has_role?(:editor)
|
90
80
|
end
|
91
81
|
|
92
|
-
def viewer?
|
93
|
-
|
82
|
+
def viewer?
|
83
|
+
user.present? && user.has_role?(:viewer)
|
94
84
|
end
|
95
85
|
|
96
86
|
def has_global_role?
|
@@ -102,7 +92,7 @@ module G5Authenticatable
|
|
102
92
|
end
|
103
93
|
|
104
94
|
def global_role?
|
105
|
-
|
95
|
+
user.roles.global.exists?
|
106
96
|
end
|
107
97
|
end
|
108
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: g5_authenticatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.2.rc.
|
4
|
+
version: 1.1.2.rc.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maeve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise_g5_authenticatable
|