Last active
March 14, 2019 19:16
-
-
Save mikena-truss/da0b11bdd83e8f38fb48e104294db735 to your computer and use it in GitHub Desktop.
Example auth filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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