action_authorization 0.3.1 → 0.3.3

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
  SHA256:
3
- metadata.gz: d6ec2bb21ab2cd6e7a6fc961076931ba385d327272437427e2653f07dabd0901
4
- data.tar.gz: 6b01e8b343d8fc465e9ad5c36bf76f515ca7f1b809bfc28f2ba4f66d106f6d5c
3
+ metadata.gz: fb47292dbbc20da84de15b97b546bfe3992c15d76ced260631dd3de722e6ea0d
4
+ data.tar.gz: e832054d9d6c68d969cb1dbe7b5bda50b91fd50f9b3c1b7c88b376275f387f86
5
5
  SHA512:
6
- metadata.gz: d91740824f6f3aca60f1c98de4ac7fea9e3e231e710e1ce027465cb8908596264885710c0d3b3ca98d8cd877d26d9ef83a3d1c6848624aa171f2bedc0798fe52
7
- data.tar.gz: 8f6b3b6a14ba8533f6361aa1cd1241141ee246ee1561098cfa88fba41b53d64124be783a4a45ec01b4ef95fe2f3628b327b17f4171652be16e4e8d33bb775d4a
6
+ metadata.gz: be44e07c7f4861eb04733f38684ff960236c702e731b4f5d0cd69f46f0f3dc2b8df6d3f25879ee3d1038d72b8c0e465e8c8c48e98212d3bd54a7430d2fe9a393
7
+ data.tar.gz: f17d11f851c42110985e49435174a5f66419e3af3a0341196941036008a14fc45912c55d88cb03bd05ef8c3415de3a5b993b40804471e42efcbd2a19277732fe
@@ -16,7 +16,7 @@ module ActionAuthorization
16
16
 
17
17
  delegate :type, :type_class, to: :class
18
18
 
19
- def initialize(user, object)
19
+ def initialize(user, object = nil)
20
20
  self.user = user
21
21
  self.object = object
22
22
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionAuthorization
4
+ class NullPolicy < BasePolicy
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionAuthorization
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.3"
5
5
  end
@@ -4,6 +4,7 @@ require "active_support/core_ext/module/delegation"
4
4
  require "active_support/core_ext/string/inflections"
5
5
  require "action_authorization/version"
6
6
  require "action_authorization/base_policy"
7
+ require "action_authorization/null_policy"
7
8
  require "action_authorization/authorization_failure"
8
9
 
9
10
  module ActionAuthorization
@@ -26,6 +27,6 @@ module ActionAuthorization
26
27
  end
27
28
 
28
29
  def policy_class_for(object)
29
- "#{object.model_name}Policy".constantize
30
+ object.nil? ? NullPolicy : "#{object.model_name}Policy".constantize
30
31
  end
31
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Baldwin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-26 00:00:00.000000000 Z
12
+ date: 2024-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -39,6 +39,7 @@ files:
39
39
  - lib/action_authorization.rb
40
40
  - lib/action_authorization/authorization_failure.rb
41
41
  - lib/action_authorization/base_policy.rb
42
+ - lib/action_authorization/null_policy.rb
42
43
  - lib/action_authorization/version.rb
43
44
  homepage: https://github.com/wwidea/action_authorization
44
45
  licenses: