ecm_rbac 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cf1e89a7eb77a215aec78f59fecb15ee4901dc4
4
- data.tar.gz: d21393b961b790a9f650b78f8548571c6a6e269b
3
+ metadata.gz: 269fe26822998f96e10322e2bf9e81ded4847bfe
4
+ data.tar.gz: 1839c29f32c84d6eca7529b2ebcd0e6c99c910d9
5
5
  SHA512:
6
- metadata.gz: 29a8ef4774aa99d339c7a58b83ee8f448d745ddf5e7c4af3c01da6158a1608d663f9801e720dba59483507c7af1f413de2bab51b797a17161cc8819fab11cd25
7
- data.tar.gz: 60f27eb84639d188df363733afe1e8e55d4a333a2c927289d0b3834459b73a48ab48884d481d1d6b741ecab296cdedf434e2f8dfb0d04c1f4f68bf0a2a38eb9e
6
+ metadata.gz: a436b1adff3e472a1e678dc2eb145188f10823fb75955bc3e9e19a18f203d639827842efcff55a8bfbf567decee8865e67fdaf3a114118011d48f37783fa7f5e
7
+ data.tar.gz: 3db0d5c3aef09e3cc69646b0be1298b2529217cbe8721d100522aaac32657e2f725b0c6517bb8bd13cb68f2571438166b9a2d59d42a03e192aa7c3d8259292cf
@@ -6,7 +6,7 @@ module Model
6
6
 
7
7
  included do
8
8
  # associations
9
- has_many :user_roles, class_name: 'Ecm::Rbac::UserRole', inverse_of: :user
9
+ has_many :user_roles, class_name: 'Ecm::Rbac::UserRole', inverse_of: :user, dependent: :destroy
10
10
  has_many :roles, class_name: 'Ecm::Rbac::Role', through: :user_roles
11
11
  has_many :role_permissions, class_name: 'Ecm::Rbac::RolePermission', through: :roles
12
12
  has_many :permissions, through: :role_permissions, class_name: 'Ecm::Rbac::Permission'
@@ -20,6 +20,22 @@ module Model
20
20
  def allowed_to?(permission_name)
21
21
  enabled_permissions.map(&:identifier).map(&:to_sym).include?(permission_name.to_sym)
22
22
  end
23
+
24
+ def roles_count
25
+ roles.count
26
+ end
27
+
28
+ def enabled_roles_count
29
+ enabled_roles.count
30
+ end
31
+
32
+ def permissions_count
33
+ permissions.count
34
+ end
35
+
36
+ def enabled_permissions_count
37
+ enabled_permissions.count
38
+ end
23
39
  end
24
40
  end
25
41
  end
@@ -10,7 +10,7 @@ module Ecm::Rbac
10
10
  }
11
11
 
12
12
  # associations
13
- has_many :role_permissions, class_name: 'Ecm::Rbac::RolePermission'
13
+ has_many :role_permissions, class_name: 'Ecm::Rbac::RolePermission', dependent: :destroy
14
14
  has_many :roles, class_name: 'Ecm::Rbac::Role', through: :role_permissions
15
15
  has_many :user_roles, through: :roles, class_name: 'Ecm::Rbac::UserRole'
16
16
  has_many :users, through: :user_roles, class_name: Ecm::Rbac::Configuration.user_class
@@ -25,4 +25,4 @@ de:
25
25
  one: Rolle
26
26
  other: Rollen
27
27
  classes:
28
- ecm/rbac/import_default_permissions_service: Dienst zum Einrichten von Berechtigungen
28
+ ecm/rbac/import_default_permissions_service: "Dienst zum Einrichten von Berechtigungen"
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Rbac
3
- VERSION = '0.0.3'.freeze
3
+ VERSION = '0.0.4'.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.3
4
+ version: 0.0.4
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-03-22 00:00:00.000000000 Z
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails