hubbado-trailblazer 1.3.0 → 1.4.0
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/hubbado-trailblazer.gemspec +1 -1
- data/lib/hubbado/trailblazer/run_operation.rb +20 -9
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f0d94f46fd55fd7b149ec18fb82e6923b8d828b4d9fbf4e23465bbfbd448688e
|
|
4
|
+
data.tar.gz: 5a63ac1ee253726b488acd45acbdaad37eb9af1fea81d9716f2089727aeae80f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7fb80170ecf81108173c6fcca1cf4271eb7e927f9bbc179cf2e66dc7e6f1e57b9681ecd99658af9184494330b46044d2c1cb60ab866e2c5c6efc8b08badc471f
|
|
7
|
+
data.tar.gz: afd335df6d8698d1fc89e722ba7fac1415e06b46f1722cb3796e6546d444005c98df54fb5cdbb9881ac5bd8703c8dc01d65898d7e834a68382b5be9188458bc2
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.4.0] - 2025-12-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `policy_unauthorized_message` template method to customize the policy unauthorized exception message
|
|
13
|
+
|
|
8
14
|
## [1.3.0] - 2025-11-26
|
|
9
15
|
|
|
10
16
|
### Added
|
data/hubbado-trailblazer.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "hubbado-trailblazer"
|
|
3
|
-
s.version = "1.
|
|
3
|
+
s.version = "1.4.0"
|
|
4
4
|
s.summary = "Enhanced Trailblazer operation utilities for Ruby applications with improved error handling, operation execution patterns, and ActiveRecord integration."
|
|
5
5
|
|
|
6
6
|
s.authors = ["Hubbado Devs"]
|
|
@@ -74,6 +74,10 @@ module Hubbado
|
|
|
74
74
|
ctx
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
+
template_method :policy_unauthorized_message do |ctx, operation_name:|
|
|
78
|
+
"User #{ctx[:current_user]&.id} not allowed to run #{operation_name}"
|
|
79
|
+
end
|
|
80
|
+
|
|
77
81
|
def _run_runtime_options(ctx = {}, *dependencies)
|
|
78
82
|
[_run_options(ctx), *dependencies]
|
|
79
83
|
end
|
|
@@ -88,7 +92,15 @@ module Hubbado
|
|
|
88
92
|
|
|
89
93
|
ctx = operation.send(operation_method, operation_arguments)
|
|
90
94
|
|
|
91
|
-
result = Result.new(
|
|
95
|
+
result = Result.new(
|
|
96
|
+
operation,
|
|
97
|
+
ctx,
|
|
98
|
+
trace_operation: trace_operation,
|
|
99
|
+
policy_unauthorized_message: policy_unauthorized_message(
|
|
100
|
+
ctx,
|
|
101
|
+
operation_name: operation.name
|
|
102
|
+
)
|
|
103
|
+
)
|
|
92
104
|
|
|
93
105
|
yield(result) if block_given?
|
|
94
106
|
|
|
@@ -108,11 +120,13 @@ module Hubbado
|
|
|
108
120
|
|
|
109
121
|
attr_reader :returned
|
|
110
122
|
attr_reader :trace_operation
|
|
123
|
+
attr_reader :policy_unauthorized_message
|
|
111
124
|
|
|
112
|
-
def initialize(operation, ctx, trace_operation)
|
|
125
|
+
def initialize(operation, ctx, trace_operation:, policy_unauthorized_message:)
|
|
113
126
|
@operation = operation
|
|
114
127
|
@ctx = ctx
|
|
115
128
|
@trace_operation = trace_operation
|
|
129
|
+
@policy_unauthorized_message = policy_unauthorized_message
|
|
116
130
|
end
|
|
117
131
|
|
|
118
132
|
def log_level
|
|
@@ -207,13 +221,10 @@ module Hubbado
|
|
|
207
221
|
end
|
|
208
222
|
|
|
209
223
|
def raise_policy_failed
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
"not allowed to run #{operation.name}"
|
|
215
|
-
|
|
216
|
-
raise Hubbado::Trailblazer::Errors::Unauthorized.new(msg, ctx['result.policy.default'][:policy_result])
|
|
224
|
+
raise Hubbado::Trailblazer::Errors::Unauthorized.new(
|
|
225
|
+
policy_unauthorized_message,
|
|
226
|
+
ctx['result.policy.default'][:policy_result]
|
|
227
|
+
)
|
|
217
228
|
end
|
|
218
229
|
|
|
219
230
|
def success_executed?
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hubbado-trailblazer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hubbado Devs
|
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
217
217
|
- !ruby/object:Gem::Version
|
|
218
218
|
version: '0'
|
|
219
219
|
requirements: []
|
|
220
|
-
rubygems_version:
|
|
220
|
+
rubygems_version: 4.0.1
|
|
221
221
|
specification_version: 4
|
|
222
222
|
summary: Enhanced Trailblazer operation utilities for Ruby applications with improved
|
|
223
223
|
error handling, operation execution patterns, and ActiveRecord integration.
|