pundit-plus 0.1.1 → 0.1.3

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: 03ec5ae53181cd9cdd6292e90d86510d4e9f4ae6830b855f008653cab5f39589
4
- data.tar.gz: '08c9991f40b92bdee66f747f58c8fd3b7ef3722c58e1c0264cae8811706b89fc'
3
+ metadata.gz: 7294e31ee669a032370e6f11411e14a21e35b0042cc17dcc4d12d95cff0100f0
4
+ data.tar.gz: '089db28a172510cb271460ef16b98593d30d963faafcd3df4284fa64010a35c3'
5
5
  SHA512:
6
- metadata.gz: eb3a022d9c0c68afe59ec8faa4ed96be129f8397139597bc6776463b6a06dae05b279dd0a82e1294e3a6df2bfd02ed231f8c1b7695d8610970ccdfe463823eff
7
- data.tar.gz: a88a2245f2a68f102d1cecdcb813fc8437520cfb90f83b8a645cf928543ce00cbdc3bdb321ceeeb5db7d07879d7c93df788bf78c4e910006c6eb4036817351ab
6
+ metadata.gz: 8a96685a1f150ec143f6b074e3972ae4c24b557475f069293f8f47d5508133ba1f71a8aaca0974fb478a410637aae80e781b5c3deeabcda7156db730f6b46bb8
7
+ data.tar.gz: f46cd13c2bcad4649aaaef72982f24f0196a7b8110f8c81452a68a20395a049e7b5a8c08f75ebd11ba1c58b33ceaa920ad87d3ba95081c1e8f9201a4b122563c
data/CHANGELOG.md CHANGED
@@ -2,7 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [2024-04-10]
5
+ ## [0.1.3] - 2024-10-23
6
6
 
7
7
  ### Added
8
- - Initial project setup with basic Pundit integration.
8
+
9
+ - Added support for Pundit::Context
10
+ - Using reissue for changelog and release management
11
+
12
+ ## [0.1.2] - 2024-04-10
13
+
14
+ ### Added
15
+
16
+ - Fixed the missing changelog information for the previous version.
17
+
18
+ ## [0.1.1] - 2024-04-10
19
+
20
+ ### Added
21
+
22
+ - Added params_for_action support in controller Authorization
23
+
24
+ ## [0.1.0] - 2024-04-10
25
+
26
+ ### Added
27
+
28
+ - Initial project setup with basic Pundit integration.
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Add some extra features to Pundit.
4
4
 
5
+ - Custom exceptions
6
+ - Manage required or permitted params from within your policy classes
7
+
5
8
  ## Installation
6
9
 
7
10
  Install the gem and add to the application's Gemfile by executing:
@@ -49,11 +52,21 @@ class MyPolicy < ApplicationPolicy
49
52
  end
50
53
 
51
54
  # Return the params for the action but require a special key
52
- def params_for_create(params)
53
- params_for(@record, params, :create).tap do |params|
55
+ def params_for_update(params)
56
+ params_for(@record, params, :update).tap do |params|
54
57
  params.require(:special_key)
55
58
  end
56
59
  end
60
+
61
+ def permitted_attributes
62
+ %i[name other special_key]
63
+ end
64
+ end
65
+
66
+ class SomeController < ApplicationController
67
+ def update
68
+ @some_record.update(params_for_action(@some_record))
69
+ end
57
70
  end
58
71
  ```
59
72
 
data/Rakefile CHANGED
@@ -6,3 +6,9 @@ require "rspec/core/rake_task"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  task default: :spec
9
+
10
+ require "reissue/gem"
11
+
12
+ Reissue::Task.create do |task|
13
+ task.version_file = "lib/pundit/plus/version.rb"
14
+ end
@@ -21,4 +21,9 @@ module Pundit
21
21
  end
22
22
  end
23
23
  end
24
- Pundit.singleton_class.prepend(Pundit::Plus::CustomException)
24
+
25
+ if Pundit.const_defined?(:Context)
26
+ Pundit::Context.prepend(Pundit::Plus::CustomException)
27
+ else
28
+ Pundit.singleton_class.prepend(Pundit::Plus::CustomException)
29
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pundit
4
4
  module Plus
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
data/lib/pundit/plus.rb CHANGED
@@ -24,7 +24,7 @@ module Pundit
24
24
  "permitted_attributes"
25
25
  end
26
26
 
27
- required = params.require(
27
+ params.require(
28
28
  PolicyFinder.new(record).param_key
29
29
  ).permit(
30
30
  *send(param_method)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pundit-plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-11 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pundit
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.5.5
78
+ rubygems_version: 3.5.9
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Pundit with additional features.