app/soc/views/helper/access.py
changeset 970 8b5611d5b053
parent 965 f96cc3d6120f
child 972 43018f61b481
equal deleted inserted replaced
969:b12de918d660 970:8b5611d5b053
    32 
    32 
    33 
    33 
    34 from google.appengine.api import users
    34 from google.appengine.api import users
    35 
    35 
    36 from django.core import urlresolvers
    36 from django.core import urlresolvers
    37 from django.utils.translation import ugettext_lazy
    37 from django.utils.translation import ugettext
    38 
    38 
    39 from soc.logic import accounts
    39 from soc.logic import accounts
    40 from soc.logic import dicts
    40 from soc.logic import dicts
    41 from soc.logic.models.club_admin import logic as club_admin_logic
    41 from soc.logic.models.club_admin import logic as club_admin_logic
    42 from soc.logic.models.host import logic as host_logic
    42 from soc.logic.models.host import logic as host_logic
    47 from soc.views import helper
    47 from soc.views import helper
    48 from soc.views import out_of_band
    48 from soc.views import out_of_band
    49 from soc.views.helper import redirects
    49 from soc.views.helper import redirects
    50 
    50 
    51 
    51 
    52 DEF_NO_USER_LOGIN_MSG_FMT = ugettext_lazy(
    52 DEF_NO_USER_LOGIN_MSG_FMT = ugettext(
    53   'Please create <a href="/user/edit">User Profile</a>'
    53   'Please create <a href="/user/edit">User Profile</a>'
    54   ' in order to view this page.')
    54   ' in order to view this page.')
    55 
    55 
    56 DEF_AGREE_TO_TOS_MSG_FMT = ugettext_lazy(
    56 DEF_AGREE_TO_TOS_MSG_FMT = ugettext(
    57   'You must agree to the <a href="%(tos_link)s">site-wide Terms of'
    57   'You must agree to the <a href="%(tos_link)s">site-wide Terms of'
    58   ' Service</a> in your <a href="/user/edit">User Profile</a>'
    58   ' Service</a> in your <a href="/user/edit">User Profile</a>'
    59   ' in order to view this page.')
    59   ' in order to view this page.')
    60 
    60 
    61 DEF_DEV_LOGOUT_LOGIN_MSG_FMT = ugettext_lazy(
    61 DEF_DEV_LOGOUT_LOGIN_MSG_FMT = ugettext(
    62   'Please <a href="%%(sign_out)s">sign out</a>'
    62   'Please <a href="%%(sign_out)s">sign out</a>'
    63   ' and <a href="%%(sign_in)s">sign in</a>'
    63   ' and <a href="%%(sign_in)s">sign in</a>'
    64   ' again as %(role)s to view this page.')
    64   ' again as %(role)s to view this page.')
    65 
    65 
    66 DEF_PAGE_DENIED_MSG = ugettext_lazy(
    66 DEF_PAGE_DENIED_MSG = ugettext(
    67   'Access to this page has been restricted')
    67   'Access to this page has been restricted')
    68 
    68 
    69 DEF_LOGOUT_MSG_FMT = ugettext_lazy(
    69 DEF_LOGOUT_MSG_FMT = ugettext(
    70     'Please <a href="%(sign_out)s">sign out</a> in order to view this page')
    70     'Please <a href="%(sign_out)s">sign out</a> in order to view this page')
    71 
    71 
    72 
    72 
    73 def checkAccess(access_type, request, rights, args=None, kwargs=None):
    73 def checkAccess(access_type, request, rights, args=None, kwargs=None):
    74   """Runs all the defined checks for the specified type.
    74   """Runs all the defined checks for the specified type.