rbacan 0.1.1 → 0.1.2

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
- SHA1:
3
- metadata.gz: 97b996450c3b0f0535a4c1a544c620171a3d1aed
4
- data.tar.gz: b5902253a42b4a642a9ebfafbd71d656d9c066c0
2
+ SHA256:
3
+ metadata.gz: 1bed6419a2ee45db7cedf0d6d11bba4b0259f38fc4316233f800fbf1fb452d87
4
+ data.tar.gz: b597bb84f6ed5c38b715c3e172a715513d6150d7738b89ce052a23bae6605b44
5
5
  SHA512:
6
- metadata.gz: 5fe1fd23031ca2b755a306b00402d343fb9663d5e624876ec58a6fcba3927521786c5e7dade0b69d533147ab4878e756f68af61846dd3bbda9a84e13628418bd
7
- data.tar.gz: 0f02c3af5bdd077b457cc6c3fe9769b51b44a9d408c7e2751361243c8023629c04bbaa8b6526cf22c89abe371263595a3f6e26c8e3d30c75734a58443024c1eb
6
+ metadata.gz: f9a6656415e6fc5cf803df441e4a9bc87dde63ac0ea71fbea9160c03fecc0c0aaca2f3b198ed93078f84f60d6bbdc883a9f7fbd9cac82f51aa0e5cc078ccb7a2
7
+ data.tar.gz: '03393a91233e130ce19efce5b0ec30124be0a46d31b81a5ecf0abd06c3355abf74e9a04a433012692aa711705479f8e7bf2d04172f83358fda08e0fbd43af5ce'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbacan (0.1.1)
4
+ rbacan (0.1.2)
5
5
  rails (>= 4.2)
6
6
 
7
7
  GEM
@@ -73,7 +73,7 @@ GEM
73
73
  mini_mime (1.0.2)
74
74
  mini_portile2 (2.4.0)
75
75
  minitest (5.11.3)
76
- nio4r (2.4.0)
76
+ nio4r (2.5.1)
77
77
  nokogiri (1.10.4)
78
78
  mini_portile2 (~> 2.4.0)
79
79
  rack (2.0.7)
@@ -43,7 +43,7 @@ module Rbacan
43
43
 
44
44
  def assign_role(role_name)
45
45
  assigned_role = Role.find_by_name(role_name)
46
- @@user_role_class.create(user_id: self.id, role_id: assigned_role.id)
46
+ @@user_role_class.find_or_create_by(user_id: self.id, role_id: assigned_role.id)
47
47
  end
48
48
 
49
49
  def remove_user_role(role_name)
@@ -11,7 +11,8 @@ module Rbacan
11
11
 
12
12
  def assign_role(role_name)
13
13
  assigned_role = Rbacan::Role.find_by_name(role_name)
14
- Rbacan::UserRole.create(user_id: self.id, role_id: assigned_role.id)
14
+ self.user_roles.find_or_create_by(role_id: assigned_role.id)
15
+ self.save if self.persisted?
15
16
  end
16
17
 
17
18
  def remove_role(role_name)
@@ -1,3 +1,3 @@
1
1
  module Rbacan
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -12,12 +12,12 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q{a gem to give permission access to users looknig back to their roles}
13
13
  spec.description = %q{RBACan is a Role-based access control tool to control user access to the functionnalities of your application}
14
14
  spec.homepage = "https://github.com/hamdi777/RBACan"
15
- spec.license = "MIT"
15
+ spec.licenses = ["MIT"]
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
19
  if spec.respond_to?(:metadata)
20
- spec.metadata["allowed_push_host"] = "https://rubygems.org/profiles/hamdi777"
20
+ # spec.metadata["allowed_push_host"] = "https://rubygems.org/profiles/hamdi777"
21
21
 
22
22
  spec.metadata["homepage_uri"] = spec.homepage
23
23
  spec.metadata["source_code_uri"] = "https://rubygems.org/profiles/hamdi777"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbacan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hamdi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-26 00:00:00.000000000 Z
11
+ date: 2019-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -141,7 +141,6 @@ homepage: https://github.com/hamdi777/RBACan
141
141
  licenses:
142
142
  - MIT
143
143
  metadata:
144
- allowed_push_host: https://rubygems.org/profiles/hamdi777
145
144
  homepage_uri: https://github.com/hamdi777/RBACan
146
145
  source_code_uri: https://rubygems.org/profiles/hamdi777
147
146
  changelog_uri: https://rubygems.org/profiles/hamdi777/CHANGELOG.md
@@ -160,8 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
159
  - !ruby/object:Gem::Version
161
160
  version: '0'
162
161
  requirements: []
163
- rubyforge_project:
164
- rubygems_version: 2.6.13
162
+ rubygems_version: 3.0.6
165
163
  signing_key:
166
164
  specification_version: 4
167
165
  summary: a gem to give permission access to users looknig back to their roles