Last active
August 29, 2015 14:23
-
-
Save mstruve/4bf50b31ed39f64b6627 to your computer and use it in GitHub Desktop.
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
before do | |
client = Client.active.find_by(token: headers["Auth-Token"]) | |
error!('Unauthorized. Invalid token.', 401) unless client | |
error!('Unauthorized action.', 403) unless client.user_authorization_required? && User.new(headers["X-Grpn-Email"]).authorized_action?(request.request_method) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment