Chromium Code Reviews (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out

Side by Side Diff: appengine/monorail/framework/

Issue 1868553004: Open Source Monorail (Closed) Base URL:
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 #
6 """A class to display the a message explaining that the user has been banned.
8 We can ban a user for anti-social behavior. We indicate that the user is
9 banned by adding a 'banned' field to his/her User PB in the DB. Whenever
10 a user with a banned indicator visits any page, AssertBasePermission()
11 checks has_banned and redirects to this page.
12 """
14 import logging
16 from framework import permissions
17 from framework import servlet
20 class Banned(servlet.Servlet):
21 """The Banned page shows a message explaining that the user is banned."""
23 _PAGE_TEMPLATE = 'framework/banned-page.ezt'
25 def AssertBasePermission(self, mr):
26 """Allow banned users to see this page, and prevent non-banned users."""
27 # Note, we do not call Servlet.AssertBasePermission because
28 # that would redirect banned users here again in an endless loop.
30 # We only show this page to users who are banned. If a non-banned user
31 # follows a link to this URL, don't show the banned message, because that
32 # would lead to a big misunderstanding.
33 if not permissions.IsBanned(mr.auth.user_pb, mr.auth.user_view):
34'non-banned user: %s', mr.auth.user_pb)
35 self.abort(404)
37 def GatherPageData(self, _mr):
38 """Build up a dictionary of data values to use when rendering the page."""
39 return {
40 # We do not actually display the specific reason for banning.
41 # That info is available via command-line tools..
43 # Make the "Sign Out" link just sign out, don't try to bring the
44 # user back to this page after they sign out.
45 'currentPageURLEncoded': None,
46 }
« no previous file with comments | « appengine/monorail/framework/ ('k') | appengine/monorail/framework/ » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698