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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 269fe26822998f96e10322e2bf9e81ded4847bfe
4
- data.tar.gz: 1839c29f32c84d6eca7529b2ebcd0e6c99c910d9
3
+ metadata.gz: bdc9e90066f59fe5ffc173fafc22c19d8cd4fbbf
4
+ data.tar.gz: f2902a065d129b8fc9d354002ed2db7e1d46f79a
5
5
  SHA512:
6
- metadata.gz: a436b1adff3e472a1e678dc2eb145188f10823fb75955bc3e9e19a18f203d639827842efcff55a8bfbf567decee8865e67fdaf3a114118011d48f37783fa7f5e
7
- data.tar.gz: 3db0d5c3aef09e3cc69646b0be1298b2529217cbe8721d100522aaac32657e2f725b0c6517bb8bd13cb68f2571438166b9a2d59d42a03e192aa7c3d8259292cf
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?(permission_name)
21
- enabled_permissions.map(&:identifier).map(&:to_sym).include?(permission_name.to_sym)
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
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Rbac
3
- VERSION = '0.0.4'.freeze
3
+ VERSION = '0.0.8'.freeze
4
4
  end
5
5
  end
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
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-05 00:00:00.000000000 Z
11
+ date: 2016-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails