@@ -205,15 +205,15 @@ type AllowAuthorizer struct {
205205
206206// ACLReadAllowed checks for permission to list all the ACLs
207207func (a AllowAuthorizer ) ACLReadAllowed (ctx * AuthorizerContext ) error {
208- if a .Authorizer . ACLRead (ctx ) != Allow {
208+ if a .ACLRead (ctx ) != Allow {
209209 return PermissionDeniedByACLUnnamed (a , ctx , ResourceACL , AccessRead )
210210 }
211211 return nil
212212}
213213
214214// ACLWriteAllowed checks for permission to manipulate ACLs
215215func (a AllowAuthorizer ) ACLWriteAllowed (ctx * AuthorizerContext ) error {
216- if a .Authorizer . ACLWrite (ctx ) != Allow {
216+ if a .ACLWrite (ctx ) != Allow {
217217 return PermissionDeniedByACLUnnamed (a , ctx , ResourceACL , AccessWrite )
218218 }
219219 return nil
@@ -222,7 +222,7 @@ func (a AllowAuthorizer) ACLWriteAllowed(ctx *AuthorizerContext) error {
222222// AgentReadAllowed checks for permission to read from agent endpoints for a
223223// given node.
224224func (a AllowAuthorizer ) AgentReadAllowed (name string , ctx * AuthorizerContext ) error {
225- if a .Authorizer . AgentRead (name , ctx ) != Allow {
225+ if a .AgentRead (name , ctx ) != Allow {
226226 return PermissionDeniedByACL (a , ctx , ResourceAgent , AccessRead , name )
227227 }
228228 return nil
@@ -231,31 +231,31 @@ func (a AllowAuthorizer) AgentReadAllowed(name string, ctx *AuthorizerContext) e
231231// AgentWriteAllowed checks for permission to make changes via agent endpoints
232232// for a given node.
233233func (a AllowAuthorizer ) AgentWriteAllowed (name string , ctx * AuthorizerContext ) error {
234- if a .Authorizer . AgentWrite (name , ctx ) != Allow {
234+ if a .AgentWrite (name , ctx ) != Allow {
235235 return PermissionDeniedByACL (a , ctx , ResourceAgent , AccessWrite , name )
236236 }
237237 return nil
238238}
239239
240240// EventReadAllowed determines if a specific event can be queried.
241241func (a AllowAuthorizer ) EventReadAllowed (name string , ctx * AuthorizerContext ) error {
242- if a .Authorizer . EventRead (name , ctx ) != Allow {
242+ if a .EventRead (name , ctx ) != Allow {
243243 return PermissionDeniedByACL (a , ctx , ResourceEvent , AccessRead , name )
244244 }
245245 return nil
246246}
247247
248248// EventWriteAllowed determines if a specific event may be fired.
249249func (a AllowAuthorizer ) EventWriteAllowed (name string , ctx * AuthorizerContext ) error {
250- if a .Authorizer . EventWrite (name , ctx ) != Allow {
250+ if a .EventWrite (name , ctx ) != Allow {
251251 return PermissionDeniedByACL (a , ctx , ResourceEvent , AccessWrite , name )
252252 }
253253 return nil
254254}
255255
256256// IntentionReadAllowed determines if a specific intention can be read.
257257func (a AllowAuthorizer ) IntentionReadAllowed (name string , ctx * AuthorizerContext ) error {
258- if a .Authorizer . IntentionRead (name , ctx ) != Allow {
258+ if a .IntentionRead (name , ctx ) != Allow {
259259 return PermissionDeniedByACL (a , ctx , ResourceIntention , AccessRead , name )
260260 }
261261 return nil
@@ -264,15 +264,15 @@ func (a AllowAuthorizer) IntentionReadAllowed(name string, ctx *AuthorizerContex
264264// IntentionWriteAllowed determines if a specific intention can be
265265// created, modified, or deleted.
266266func (a AllowAuthorizer ) IntentionWriteAllowed (name string , ctx * AuthorizerContext ) error {
267- if a .Authorizer . IntentionWrite (name , ctx ) != Allow {
267+ if a .IntentionWrite (name , ctx ) != Allow {
268268 return PermissionDeniedByACL (a , ctx , ResourceIntention , AccessWrite , name )
269269 }
270270 return nil
271271}
272272
273273// TrafficPermissionsReadAllowed determines if specific traffic permissions can be read.
274274func (a AllowAuthorizer ) TrafficPermissionsReadAllowed (name string , ctx * AuthorizerContext ) error {
275- if a .Authorizer . TrafficPermissionsRead (name , ctx ) != Allow {
275+ if a .TrafficPermissionsRead (name , ctx ) != Allow {
276276 return PermissionDeniedByACL (a , ctx , ResourceIntention , AccessRead , name )
277277 }
278278 return nil
@@ -281,31 +281,31 @@ func (a AllowAuthorizer) TrafficPermissionsReadAllowed(name string, ctx *Authori
281281// TrafficPermissionsWriteAllowed determines if specific traffic permissions can be
282282// created, modified, or deleted.
283283func (a AllowAuthorizer ) TrafficPermissionsWriteAllowed (name string , ctx * AuthorizerContext ) error {
284- if a .Authorizer . TrafficPermissionsWrite (name , ctx ) != Allow {
284+ if a .TrafficPermissionsWrite (name , ctx ) != Allow {
285285 return PermissionDeniedByACL (a , ctx , ResourceIntention , AccessWrite , name )
286286 }
287287 return nil
288288}
289289
290290// KeyListAllowed checks for permission to list keys under a prefix
291291func (a AllowAuthorizer ) KeyListAllowed (name string , ctx * AuthorizerContext ) error {
292- if a .Authorizer . KeyList (name , ctx ) != Allow {
292+ if a .KeyList (name , ctx ) != Allow {
293293 return PermissionDeniedByACL (a , ctx , ResourceKey , AccessList , name )
294294 }
295295 return nil
296296}
297297
298298// KeyReadAllowed checks for permission to read a given key
299299func (a AllowAuthorizer ) KeyReadAllowed (name string , ctx * AuthorizerContext ) error {
300- if a .Authorizer . KeyRead (name , ctx ) != Allow {
300+ if a .KeyRead (name , ctx ) != Allow {
301301 return PermissionDeniedByACL (a , ctx , ResourceKey , AccessRead , name )
302302 }
303303 return nil
304304}
305305
306306// KeyWriteAllowed checks for permission to write a given key
307307func (a AllowAuthorizer ) KeyWriteAllowed (name string , ctx * AuthorizerContext ) error {
308- if a .Authorizer . KeyWrite (name , ctx ) != Allow {
308+ if a .KeyWrite (name , ctx ) != Allow {
309309 return PermissionDeniedByACL (a , ctx , ResourceKey , AccessWrite , name )
310310 }
311311 return nil
@@ -315,7 +315,7 @@ func (a AllowAuthorizer) KeyWriteAllowed(name string, ctx *AuthorizerContext) er
315315// entire key prefix. This means there must be no sub-policies
316316// that deny a write.
317317func (a AllowAuthorizer ) KeyWritePrefixAllowed (name string , ctx * AuthorizerContext ) error {
318- if a .Authorizer . KeyWritePrefix (name , ctx ) != Allow {
318+ if a .KeyWritePrefix (name , ctx ) != Allow {
319319 // TODO(acl-error-enhancements) revisit this message; we may need to do some extra plumbing inside of KeyWritePrefix to
320320 // return properly detailed information.
321321 return PermissionDeniedByACL (a , ctx , ResourceKey , AccessWrite , name )
@@ -326,15 +326,15 @@ func (a AllowAuthorizer) KeyWritePrefixAllowed(name string, ctx *AuthorizerConte
326326// KeyringReadAllowed determines if the encryption keyring used in
327327// the gossip layer can be read.
328328func (a AllowAuthorizer ) KeyringReadAllowed (ctx * AuthorizerContext ) error {
329- if a .Authorizer . KeyringRead (ctx ) != Allow {
329+ if a .KeyringRead (ctx ) != Allow {
330330 return PermissionDeniedByACLUnnamed (a , ctx , ResourceKeyring , AccessRead )
331331 }
332332 return nil
333333}
334334
335335// KeyringWriteAllowed determines if the keyring can be manipulated
336336func (a AllowAuthorizer ) KeyringWriteAllowed (ctx * AuthorizerContext ) error {
337- if a .Authorizer . KeyringWrite (ctx ) != Allow {
337+ if a .KeyringWrite (ctx ) != Allow {
338338 return PermissionDeniedByACLUnnamed (a , ctx , ResourceKeyring , AccessWrite )
339339 }
340340 return nil
@@ -343,7 +343,7 @@ func (a AllowAuthorizer) KeyringWriteAllowed(ctx *AuthorizerContext) error {
343343// MeshReadAllowed determines if the read-only Consul mesh functions
344344// can be used.
345345func (a AllowAuthorizer ) MeshReadAllowed (ctx * AuthorizerContext ) error {
346- if a .Authorizer . MeshRead (ctx ) != Allow {
346+ if a .MeshRead (ctx ) != Allow {
347347 return PermissionDeniedByACLUnnamed (a , ctx , ResourceMesh , AccessRead )
348348 }
349349 return nil
@@ -352,7 +352,7 @@ func (a AllowAuthorizer) MeshReadAllowed(ctx *AuthorizerContext) error {
352352// MeshWriteAllowed determines if the state-changing Consul mesh
353353// functions can be used.
354354func (a AllowAuthorizer ) MeshWriteAllowed (ctx * AuthorizerContext ) error {
355- if a .Authorizer . MeshWrite (ctx ) != Allow {
355+ if a .MeshWrite (ctx ) != Allow {
356356 return PermissionDeniedByACLUnnamed (a , ctx , ResourceMesh , AccessWrite )
357357 }
358358 return nil
@@ -361,7 +361,7 @@ func (a AllowAuthorizer) MeshWriteAllowed(ctx *AuthorizerContext) error {
361361// PeeringReadAllowed determines if the read-only Consul peering functions
362362// can be used.
363363func (a AllowAuthorizer ) PeeringReadAllowed (ctx * AuthorizerContext ) error {
364- if a .Authorizer . PeeringRead (ctx ) != Allow {
364+ if a .PeeringRead (ctx ) != Allow {
365365 return PermissionDeniedByACLUnnamed (a , ctx , ResourcePeering , AccessRead )
366366 }
367367 return nil
@@ -370,23 +370,23 @@ func (a AllowAuthorizer) PeeringReadAllowed(ctx *AuthorizerContext) error {
370370// PeeringWriteAllowed determines if the state-changing Consul peering
371371// functions can be used.
372372func (a AllowAuthorizer ) PeeringWriteAllowed (ctx * AuthorizerContext ) error {
373- if a .Authorizer . PeeringWrite (ctx ) != Allow {
373+ if a .PeeringWrite (ctx ) != Allow {
374374 return PermissionDeniedByACLUnnamed (a , ctx , ResourcePeering , AccessWrite )
375375 }
376376 return nil
377377}
378378
379379// NodeReadAllowed checks for permission to read (discover) a given node.
380380func (a AllowAuthorizer ) NodeReadAllowed (name string , ctx * AuthorizerContext ) error {
381- if a .Authorizer . NodeRead (name , ctx ) != Allow {
381+ if a .NodeRead (name , ctx ) != Allow {
382382 return PermissionDeniedByACL (a , ctx , ResourceNode , AccessRead , name )
383383 }
384384 return nil
385385}
386386
387387// NodeReadAllAllowed checks for permission to read (discover) all nodes.
388388func (a AllowAuthorizer ) NodeReadAllAllowed (ctx * AuthorizerContext ) error {
389- if a .Authorizer . NodeReadAll (ctx ) != Allow {
389+ if a .NodeReadAll (ctx ) != Allow {
390390 // This is only used to gate certain UI functions right now (e.g metrics)
391391 return PermissionDeniedByACL (a , ctx , ResourceNode , AccessRead , "all nodes" )
392392 }
@@ -396,7 +396,7 @@ func (a AllowAuthorizer) NodeReadAllAllowed(ctx *AuthorizerContext) error {
396396// NodeWriteAllowed checks for permission to create or update (register) a
397397// given node.
398398func (a AllowAuthorizer ) NodeWriteAllowed (name string , ctx * AuthorizerContext ) error {
399- if a .Authorizer . NodeWrite (name , ctx ) != Allow {
399+ if a .NodeWrite (name , ctx ) != Allow {
400400 return PermissionDeniedByACL (a , ctx , ResourceNode , AccessWrite , name )
401401 }
402402 return nil
@@ -405,7 +405,7 @@ func (a AllowAuthorizer) NodeWriteAllowed(name string, ctx *AuthorizerContext) e
405405// OperatorReadAllowed determines if the read-only Consul operator functions
406406// can be used.
407407func (a AllowAuthorizer ) OperatorReadAllowed (ctx * AuthorizerContext ) error {
408- if a .Authorizer . OperatorRead (ctx ) != Allow {
408+ if a .OperatorRead (ctx ) != Allow {
409409 return PermissionDeniedByACLUnnamed (a , ctx , ResourceOperator , AccessRead )
410410 }
411411 return nil
@@ -414,7 +414,7 @@ func (a AllowAuthorizer) OperatorReadAllowed(ctx *AuthorizerContext) error {
414414// OperatorWriteAllowed determines if the state-changing Consul operator
415415// functions can be used.
416416func (a AllowAuthorizer ) OperatorWriteAllowed (ctx * AuthorizerContext ) error {
417- if a .Authorizer . OperatorWrite (ctx ) != Allow {
417+ if a .OperatorWrite (ctx ) != Allow {
418418 return PermissionDeniedByACLUnnamed (a , ctx , ResourceOperator , AccessWrite )
419419 }
420420 return nil
@@ -423,7 +423,7 @@ func (a AllowAuthorizer) OperatorWriteAllowed(ctx *AuthorizerContext) error {
423423// PreparedQueryReadAllowed determines if a specific prepared query can be read
424424// to show its contents (this is not used for execution).
425425func (a AllowAuthorizer ) PreparedQueryReadAllowed (name string , ctx * AuthorizerContext ) error {
426- if a .Authorizer . PreparedQueryRead (name , ctx ) != Allow {
426+ if a .PreparedQueryRead (name , ctx ) != Allow {
427427 return PermissionDeniedByACL (a , ctx , ResourceQuery , AccessRead , name )
428428 }
429429 return nil
@@ -432,23 +432,23 @@ func (a AllowAuthorizer) PreparedQueryReadAllowed(name string, ctx *AuthorizerCo
432432// PreparedQueryWriteAllowed determines if a specific prepared query can be
433433// created, modified, or deleted.
434434func (a AllowAuthorizer ) PreparedQueryWriteAllowed (name string , ctx * AuthorizerContext ) error {
435- if a .Authorizer . PreparedQueryWrite (name , ctx ) != Allow {
435+ if a .PreparedQueryWrite (name , ctx ) != Allow {
436436 return PermissionDeniedByACL (a , ctx , ResourceQuery , AccessWrite , name )
437437 }
438438 return nil
439439}
440440
441441// ServiceReadAllowed checks for permission to read a given service
442442func (a AllowAuthorizer ) ServiceReadAllowed (name string , ctx * AuthorizerContext ) error {
443- if a .Authorizer . ServiceRead (name , ctx ) != Allow {
443+ if a .ServiceRead (name , ctx ) != Allow {
444444 return PermissionDeniedByACL (a , ctx , ResourceService , AccessRead , name )
445445 }
446446 return nil
447447}
448448
449449// ServiceReadAllAllowed checks for permission to read all services
450450func (a AllowAuthorizer ) ServiceReadAllAllowed (ctx * AuthorizerContext ) error {
451- if a .Authorizer . ServiceReadAll (ctx ) != Allow {
451+ if a .ServiceReadAll (ctx ) != Allow {
452452 // This is only used to gate certain UI functions right now (e.g metrics)
453453 return PermissionDeniedByACL (a , ctx , ResourceService , AccessRead , "all services" ) // read
454454 }
@@ -457,7 +457,7 @@ func (a AllowAuthorizer) ServiceReadAllAllowed(ctx *AuthorizerContext) error {
457457
458458// ServiceReadPrefixAllowed checks for permission to read services within the given prefix
459459func (a AllowAuthorizer ) ServiceReadPrefixAllowed (prefix string , ctx * AuthorizerContext ) error {
460- if a .Authorizer . ServiceReadPrefix (prefix , ctx ) != Allow {
460+ if a .ServiceReadPrefix (prefix , ctx ) != Allow {
461461 return PermissionDeniedByACL (a , ctx , ResourceService , AccessRead , prefix ) // read
462462 }
463463 return nil
@@ -466,23 +466,23 @@ func (a AllowAuthorizer) ServiceReadPrefixAllowed(prefix string, ctx *Authorizer
466466// ServiceWriteAllowed checks for permission to create or update a given
467467// service
468468func (a AllowAuthorizer ) ServiceWriteAllowed (name string , ctx * AuthorizerContext ) error {
469- if a .Authorizer . ServiceWrite (name , ctx ) != Allow {
469+ if a .ServiceWrite (name , ctx ) != Allow {
470470 return PermissionDeniedByACL (a , ctx , ResourceService , AccessWrite , name )
471471 }
472472 return nil
473473}
474474
475475// ServiceWriteAnyAllowed checks for write permission on any service
476476func (a AllowAuthorizer ) ServiceWriteAnyAllowed (ctx * AuthorizerContext ) error {
477- if a .Authorizer . ServiceWriteAny (ctx ) != Allow {
477+ if a .ServiceWriteAny (ctx ) != Allow {
478478 return PermissionDeniedByACL (a , ctx , ResourceService , AccessWrite , "any service" )
479479 }
480480 return nil
481481}
482482
483483// SessionReadAllowed checks for permission to read sessions for a given node.
484484func (a AllowAuthorizer ) SessionReadAllowed (name string , ctx * AuthorizerContext ) error {
485- if a .Authorizer . SessionRead (name , ctx ) != Allow {
485+ if a .SessionRead (name , ctx ) != Allow {
486486 return PermissionDeniedByACL (a , ctx , ResourceSession , AccessRead , name )
487487 }
488488 return nil
@@ -491,15 +491,15 @@ func (a AllowAuthorizer) SessionReadAllowed(name string, ctx *AuthorizerContext)
491491// SessionWriteAllowed checks for permission to create sessions for a given
492492// node.
493493func (a AllowAuthorizer ) SessionWriteAllowed (name string , ctx * AuthorizerContext ) error {
494- if a .Authorizer . SessionWrite (name , ctx ) != Allow {
494+ if a .SessionWrite (name , ctx ) != Allow {
495495 return PermissionDeniedByACL (a , ctx , ResourceSession , AccessWrite , name )
496496 }
497497 return nil
498498}
499499
500500// SnapshotAllowed checks for permission to take and restore snapshots.
501501func (a AllowAuthorizer ) SnapshotAllowed (ctx * AuthorizerContext ) error {
502- if a .Authorizer . Snapshot (ctx ) != Allow {
502+ if a .Snapshot (ctx ) != Allow {
503503 // Implementation of this currently just checks acl write
504504 return PermissionDeniedByACLUnnamed (a , ctx , ResourceACL , AccessWrite )
505505 }
0 commit comments