ecm_rbac 0.0.4 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/model/ecm/rbac/user_concern.rb +15 -2
- data/lib/ecm/rbac/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdc9e90066f59fe5ffc173fafc22c19d8cd4fbbf
|
4
|
+
data.tar.gz: f2902a065d129b8fc9d354002ed2db7e1d46f79a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7c22380e0be083f4babc5341eb14bcaf50d36d7c5432c41fd10a2ed3756693e59e1e3ce6af7d2a6ba57fdb90c7000b7cf585aa4e11f340b2f8fe2b39cc2016c
|
7
|
+
data.tar.gz: 438dd72d8c21480d99b8155fbe3ba103ccd8ccc85496203d5122d3a642d17430f0c622218460bee080d5c2ba868cd96742ef8f938018ecdcfa6496bd9654ef35
|
@@ -17,8 +17,21 @@ module Model
|
|
17
17
|
has_many :enabled_permissions, through: :enabled_role_permissions, class_name: 'Ecm::Rbac::Permission', source: :permission
|
18
18
|
end
|
19
19
|
|
20
|
-
def allowed_to?(
|
21
|
-
enabled_permissions.map(&:identifier).map(&:to_sym).include?(
|
20
|
+
def allowed_to?(permission_identifier)
|
21
|
+
enabled_permissions.map(&:identifier).map(&:to_sym).include?(permission_identifier.to_sym)
|
22
|
+
end
|
23
|
+
|
24
|
+
def has_role?(role_identifier)
|
25
|
+
enabled_roles.map(&:identifier).map(&:to_sym).include?(role_identifier.to_sym)
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_role(role_identifier)
|
29
|
+
role = ::Ecm::Rbac::Role.where(identifier: role_identifier).first
|
30
|
+
if role
|
31
|
+
roles << role
|
32
|
+
else
|
33
|
+
false
|
34
|
+
end
|
22
35
|
end
|
23
36
|
|
24
37
|
def roles_count
|
data/lib/ecm/rbac/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_rbac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|