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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09f4066dfca50737fffb9834fffeee4dd9a87d830b5be7045ed1f3206b1c7c9f'
4
- data.tar.gz: e7ef11855457d8a41bd78c5d21d87f10c4e7b6ee30f52ff05f9c43a1f6911dcc
3
+ metadata.gz: d5325487f08e32770f5497a9f4da647a8e647705deaf5fe1198ee6b3a7ad5c41
4
+ data.tar.gz: fba91fae9ef553b86b88b47dbc88b44c855f01af6d9c300a9ed0e06c4f98a489
5
5
  SHA512:
6
- metadata.gz: 2a908e7e9ad13b38645f6acca90331a9b99d6f191c13cce01b34abd47650ec779107ec7bb9d80a770360c6e1a8486eaf074f5a6f60de8203cef2fb44c3d59975
7
- data.tar.gz: ae50c95974c7cd7d186da96ea749168098efeb7d41877c1553c437e11c184846b91af07b63c55b802e0f45875c781870b5016d880ab5e3f11dedf901f0366a1a
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 check_for_role(role_name,global_scope=false)
75
- if user.present?
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?(global_scope=false)
89
- check_for_role(:editor,global_scope)
78
+ def editor?
79
+ user.present? && user.has_role?(:editor)
90
80
  end
91
81
 
92
- def viewer?(global_scope=false)
93
- check_for_role(:viewer,global_scope)
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
- super_admin? || admin?(true) || editor?(true) || viewer?(true)
95
+ user.roles.global.exists?
106
96
  end
107
97
  end
108
98
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module G5Authenticatable
4
- VERSION = '1.1.2.rc.3'
4
+ VERSION = '1.1.2.rc.4'
5
5
  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.3
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-28 00:00:00.000000000 Z
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