File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ const (
23
23
)
24
24
25
25
var (
26
- ctxKeyChecker = checkerCtxKey {}
26
+ // CheckerCtxKey is the context key used to set the checker handling function
27
+ CheckerCtxKey = checkerCtxKey {}
27
28
28
29
// DefaultAllowChecker defaults to allow when checker is disabled or skipped
29
30
DefaultAllowChecker Checker = func (_ context.Context , _ gidx.PrefixedID , _ string ) error {
@@ -179,7 +180,7 @@ func setCheckerContext(c echo.Context, checker Checker) {
179
180
req := c .Request ().WithContext (
180
181
context .WithValue (
181
182
c .Request ().Context (),
182
- ctxKeyChecker ,
183
+ CheckerCtxKey ,
183
184
checker ,
184
185
),
185
186
)
@@ -201,7 +202,7 @@ func ensureValidServerResponse(resp *http.Response) error {
201
202
202
203
// CheckAccess runs the checker function to check if the provided resource and action are supported.
203
204
func CheckAccess (ctx context.Context , resource gidx.PrefixedID , action string ) error {
204
- checker , ok := ctx .Value (ctxKeyChecker ).(Checker )
205
+ checker , ok := ctx .Value (CheckerCtxKey ).(Checker )
205
206
if ! ok {
206
207
return ErrCheckerNotFound
207
208
}
You can’t perform that action at this time.
0 commit comments