rabarber 0.1.3 → 0.1.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: efe276f264ab3b14fb15221050a9876054fc9cda73cd62af4a68b177658af585
4
- data.tar.gz: be88e7ead8056ba296ede08d74da565ebb3c2e1ea53d203d0b68b29c38cb2076
3
+ metadata.gz: defa329a94240744ede0911a0d2724a93d5820637614d68c9d4eedd925459951
4
+ data.tar.gz: ef33ca54c1d80bc2986435eb61462e5a47c37ba7c3d04cdd33a2a8a5d2ce2d73
5
5
  SHA512:
6
- metadata.gz: 8136281097de32e13774e3beafb60a55bdd031d6f9fec9e2d09a43e746d6a044c13b269e02b086037b8c538c0d35b514ac509ad21c5dfdcf9173013dbeb35f5a
7
- data.tar.gz: 9479c30544c7ce6a56b418fc6c25fb0470dbdfd6e0a069114bc3616b7b6aaa03756881b6ef2173dd2d4f332e2a3cea0751e322764aa241a70eccd0cc7c45e675
6
+ metadata.gz: 54a16170222252d4f067686a4c129e61ff92a649504d815e11f76d74e4fb33984cf76eaa048d7b474b4dd93f89f8f816bface0456bdd9a19a6b1b17bbd12a5ae
7
+ data.tar.gz: fc89759b5cce5e8adc0dbd87aacbba28dd728a89342a72f69ff1a8366d485ec987f716febc005e8e3405d805d51d5e74523abcf830442dfbb120d4a9cb727026
data/.rubocop.yml CHANGED
@@ -11,6 +11,9 @@ Layout/LineLength:
11
11
  Metrics/BlockLength:
12
12
  Enabled: false
13
13
 
14
+ Naming/PredicateName:
15
+ Enabled: false
16
+
14
17
  Rails/ApplicationController:
15
18
  Exclude:
16
19
  - spec/support/controllers.rb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.4
2
+
3
+ - Remove `role?` method as unnecessary
4
+ - Update README
5
+
1
6
  ## 0.1.3
2
7
 
3
8
  - Revise and update README for clarity
data/README.md CHANGED
@@ -109,6 +109,14 @@ To view all the roles assigned to the user, use:
109
109
  ```rb
110
110
  user.roles
111
111
  ```
112
+ This will return an array of `Rabarber::Role` objects.
113
+
114
+ If you need the list of role names, use:
115
+
116
+ ```rb
117
+ user.roles.names
118
+ ```
119
+
112
120
  If you need to list all the role names available in your application, use:
113
121
 
114
122
  ```rb
@@ -5,7 +5,7 @@ module Rabarber
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- before_action :check_permissions
8
+ before_action :verify_access
9
9
  end
10
10
 
11
11
  class_methods do
@@ -16,7 +16,7 @@ module Rabarber
16
16
 
17
17
  private
18
18
 
19
- def check_permissions
19
+ def verify_access
20
20
  return if Permissions.access_granted?(
21
21
  send(::Rabarber::Configuration.instance.current_user_method).roles.names, self.class, action_name.to_sym, self
22
22
  )
@@ -12,11 +12,9 @@ module Rabarber
12
12
  has_and_belongs_to_many :roles, class_name: "Rabarber::Role",
13
13
  foreign_key: "roleable_id",
14
14
  join_table: "rabarber_roles_roleables"
15
-
16
- alias_method :has_role?, :role?
17
15
  end
18
16
 
19
- def role?(*role_names)
17
+ def has_role?(*role_names)
20
18
  unless role_names.all? { |arg| arg.is_a?(Symbol) || arg.is_a?(String) }
21
19
  raise(ArgumentError, "Role names must be symbols or strings")
22
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rabarber
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabarber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - enjaku4