[openstreetmap/openstreetmap-website] move #require_administrator to application controller (#2019)
Tom Hughes
notifications at github.com
Sun Oct 7 10:50:06 UTC 2018
tomhughes commented on this pull request.
> @@ -134,6 +134,20 @@ def require_moderator
end
end
+ ##
+ # require that the user is a administrator, or fill out a helpful error message
+ # and return them to the user/login page.
+ def require_administrator
+ if current_user
+ unless current_user.administrator?
+ flash[:error] = t("user.filter.not_an_administrator")
Incidentally the fact we hadn't picked that up means that the "need administrator" path in the diary entry controller is not being tested, so if you feel like adding a test for that it would be great ;-)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2019#discussion_r223208647
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20181007/f758094f/attachment.html>
More information about the rails-dev
mailing list