app/soc/views/helper/access.py
changeset 2957 f6515daaf000
parent 2956 50ce8ac13932
child 3029 3c09b9396e2e
equal deleted inserted replaced
2956:50ce8ac13932 2957:f6515daaf000
    22 either prompts for authentication, or informs the user that they
    22 either prompts for authentication, or informs the user that they
    23 do not meet the required criteria.
    23 do not meet the required criteria.
    24 """
    24 """
    25 
    25 
    26 __authors__ = [
    26 __authors__ = [
       
    27   '"Madhusudan.C.S" <madhusudancs@gmail.com>',
    27   '"Todd Larsen" <tlarsen@google.com>',
    28   '"Todd Larsen" <tlarsen@google.com>',
    28   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    29   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    29   '"Lennard de Rijk" <ljvderijk@gmail.com>',
    30   '"Lennard de Rijk" <ljvderijk@gmail.com>',
    30   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    31   '"Pawel Solyga" <pawel.solyga@gmail.com>',
    31   ]
    32   ]
    54 from soc.logic.models.user import logic as user_logic
    55 from soc.logic.models.user import logic as user_logic
    55 from soc.modules import callback
    56 from soc.modules import callback
    56 from soc.views.helper import redirects
    57 from soc.views.helper import redirects
    57 from soc.views import out_of_band
    58 from soc.views import out_of_band
    58 
    59 
       
    60 from soc.modules.ghop.logic.models.mentor import logic as ghop_mentor_logic
       
    61 from soc.modules.ghop.logic.models.organization import logic as ghop_org_logic
       
    62 from soc.modules.ghop.logic.models.org_admin import logic as \
       
    63     ghop_org_admin_logic
       
    64 from soc.modules.ghop.logic.models.program import logic as ghop_program_logic
       
    65 from soc.modules.ghop.logic.models.student import logic as ghop_student_logic
       
    66 
    59 
    67 
    60 DEF_NO_USER_LOGIN_MSG = ugettext(
    68 DEF_NO_USER_LOGIN_MSG = ugettext(
    61     'Please create <a href="/user/create_profile">User Profile</a>'
    69     'Please create <a href="/user/create_profile">User Profile</a>'
    62     ' in order to view this page.')
    70     ' in order to view this page.')
    63 
    71 
   255     'club_member': ('checkHasActiveRoleForScope', club_member_logic),
   263     'club_member': ('checkHasActiveRoleForScope', club_member_logic),
   256     'host': ('checkHasDocumentAccess', [host_logic, 'sponsor']),
   264     'host': ('checkHasDocumentAccess', [host_logic, 'sponsor']),
   257     'org_admin': ('checkHasDocumentAccess', [org_admin_logic, 'org']),
   265     'org_admin': ('checkHasDocumentAccess', [org_admin_logic, 'org']),
   258     'org_mentor': ('checkHasDocumentAccess', [mentor_logic, 'org']),
   266     'org_mentor': ('checkHasDocumentAccess', [mentor_logic, 'org']),
   259     'org_student': ('checkHasDocumentAccess', [student_logic, 'org']),
   267     'org_student': ('checkHasDocumentAccess', [student_logic, 'org']),
       
   268     'ghop_org_admin': ('checkHasDocumentAccess', [ghop_org_admin_logic, 'org']),
       
   269     'ghop_org_mentor': ('checkHasDocumentAccess', [ghop_mentor_logic, 'org']),
       
   270     'ghop_org_student': ('checkHasDocumentAccess', [ghop_student_logic, 'org']),
   260     'user': 'checkIsUser',
   271     'user': 'checkIsUser',
   261     'user_self': ('checkIsUserSelf', 'scope_path'),
   272     'user_self': ('checkIsUserSelf', 'scope_path'),
   262     }
   273     }
   263 
   274 
   264   #: the depths of various scopes to other scopes
   275   #: the depths of various scopes to other scopes
   265   # the 0 entries are not used, and are for clarity purposes only
   276   # the 0 entries are not used, and are for clarity purposes only
   266   SCOPE_DEPTH = {
   277   SCOPE_DEPTH = {
   267       'site': None,
   278       'site': None,
   268       'sponsor': (sponsor_logic, {'sponsor': 0}),
   279       'sponsor': (sponsor_logic, {'sponsor': 0}),
   269       'program': (program_logic, {'sponsor': 1, 'program': 0}),
   280       'program': (program_logic, {'sponsor': 1, 'program': 0}),
       
   281       'ghop_program': (
       
   282           ghop_program_logic, {'sponsor': 1, 'ghop_program': 0}),
   270       'org': (org_logic, {'sponsor': 2, 'program': 1, 'org': 0}),
   283       'org': (org_logic, {'sponsor': 2, 'program': 1, 'org': 0}),
       
   284       'ghop_org': (
       
   285           ghop_org_logic, {'sponsor': 2, 'ghop_program': 1, 'ghop_org': 0}),
   271       }
   286       }
   272 
   287 
   273   def __init__(self, params):
   288   def __init__(self, params):
   274     """Adopts base.rights as rights if base is set.
   289     """Adopts base.rights as rights if base is set.
   275     """
   290     """