ash/strategy.go
func (s *Strategy) Callback() *fire.Callback {
	// enforce defaults
	if s.CollectionAction == nil {
		s.CollectionAction = make(map[string][]*Authorizer)
	}
	if s.ResourceAction == nil {
		s.ResourceAction = make(map[string][]*Authorizer)
	}

	// construct and return callback
	return fire.C("ash/Strategy.Callback", fire.All(), func(ctx *fire.Context) (err error) {
		switch ctx.Operation {
		case fire.List:
			err = s.call(ctx, s.List, s.Read, s.All)
		case fire.Find:
			err = s.call(ctx, s.Find, s.Read, s.All)
		case fire.Create:
			err = s.call(ctx, s.Create, s.Write, s.All)
		case fire.Update:
			err = s.call(ctx, s.Update, s.Write, s.All)
		case fire.Delete:
			err = s.call(ctx, s.Delete, s.Write, s.All)
		case fire.CollectionAction:
			err = s.call(ctx, s.CollectionAction[ctx.JSONAPIRequest.CollectionAction], s.CollectionActions, s.Actions, s.All)
		case fire.ResourceAction:
			err = s.call(ctx, s.ResourceAction[ctx.JSONAPIRequest.ResourceAction], s.ResourceActions, s.Actions, s.All)
		}

		return err
	})
}
func (s *Strategy) Callback() *fire.Callback {
	// enforce defaults
	if s.CollectionAction == nil {
		s.CollectionAction = make(map[string][]*Authorizer)
	}
	if s.ResourceAction == nil {
		s.ResourceAction = make(map[string][]*Authorizer)
	}

	// construct and return callback
	return fire.C("ash/Strategy.Callback", fire.All(), func(ctx *fire.Context) (err error) {
		switch ctx.Operation {
		case fire.List:
			err = s.call(ctx, s.List, s.Read, s.All)
		case fire.Find:
			err = s.call(ctx, s.Find, s.Read, s.All)
		case fire.Create:
			err = s.call(ctx, s.Create, s.Write, s.All)
		case fire.Update:
			err = s.call(ctx, s.Update, s.Write, s.All)
		case fire.Delete:
			err = s.call(ctx, s.Delete, s.Write, s.All)
		case fire.CollectionAction:
			err = s.call(ctx, s.CollectionAction[ctx.JSONAPIRequest.CollectionAction], s.CollectionActions, s.Actions, s.All)
		case fire.ResourceAction:
			err = s.call(ctx, s.ResourceAction[ctx.JSONAPIRequest.ResourceAction], s.ResourceActions, s.Actions, s.All)
		}

		return err
	})
}
// Callback will return a callback that authorizes operations using the strategy.