-
-
Save paulcsmith/226ef9a8265875a5d933d7386a029934 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
class Controller | |
@@checked_authorization = false | |
macro inherited_at_end | |
unless @@checked_authorization | |
raise "Forgot to check authorization" | |
end | |
end | |
macro require_permission(permission_name) | |
@@checked_authorization = true | |
# check authorization and redirect if not authorized | |
end | |
end | |
class SuperSecretController < Controller | |
# If I forget to add this I'd like to raise at compile time | |
require_permission "can-access-secret-stuff" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment