Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example auth filter
// services/shipment/fetch_shipments.go
func newFetchShipmentsAuthorization(session Session) []Filter, err {
var filters []Filter = make([]Filter, 0)
if session.isAdmin() {
return filters, nil
} else if session.isOfficeAdmin() {
filters = append(filters, Filter{"A range filter for example..."})
return filters, nil
}
return nil, models.ErrUserUnauthorized
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.