app/soc/views/helper/access.py
changeset 2956 50ce8ac13932
parent 2936 75f9c945ed8a
child 2957 f6515daaf000
equal deleted inserted replaced
2955:b799af27440e 2956:50ce8ac13932
    32 
    32 
    33 
    33 
    34 from django.utils.translation import ugettext
    34 from django.utils.translation import ugettext
    35 
    35 
    36 from soc.logic import dicts
    36 from soc.logic import dicts
    37 from soc.logic import rights as rights_logic
       
    38 from soc.logic.helper import timeline as timeline_helper
    37 from soc.logic.helper import timeline as timeline_helper
    39 from soc.logic.models.club_admin import logic as club_admin_logic
    38 from soc.logic.models.club_admin import logic as club_admin_logic
    40 from soc.logic.models.club_member import logic as club_member_logic
    39 from soc.logic.models.club_member import logic as club_member_logic
    41 from soc.logic.models.document import logic as document_logic
    40 from soc.logic.models.document import logic as document_logic
    42 from soc.logic.models.host import logic as host_logic
    41 from soc.logic.models.host import logic as host_logic
   446       prefix: the prefix, determines what access set is used
   445       prefix: the prefix, determines what access set is used
   447       status: the access status (e.g., 'public')
   446       status: the access status (e.g., 'public')
   448       django_args: the django args to pass on to the checkers
   447       django_args: the django args to pass on to the checkers
   449     """
   448     """
   450 
   449 
   451     checker = rights_logic.Checker(prefix)
   450     checker = callback.getCore().getRightsChecker(prefix)
   452     roles = checker.getMembership(status)
   451     roles = checker.getMembership(status)
   453 
   452 
   454     message_fmt = DEF_NEED_MEMBERSHIP_MSG_FMT % {
   453     message_fmt = DEF_NEED_MEMBERSHIP_MSG_FMT % {
   455         'action': action,
   454         'action': action,
   456         'prefix': prefix,
   455         'prefix': prefix,
  1944     """
  1943     """
  1945 
  1944 
  1946     filter = django_args['filter']
  1945     filter = django_args['filter']
  1947     prefix = filter['prefix']
  1946     prefix = filter['prefix']
  1948 
  1947 
  1949     checker = rights_logic.Checker(prefix)
  1948     checker = callback.getCore().getRightsChecker(prefix)
  1950     roles = checker.getMembership('list')
  1949     roles = checker.getMembership('list')
  1951 
  1950 
  1952     if not self.hasMembership(roles, filter):
  1951     if not self.hasMembership(roles, filter):
  1953       raise out_of_band.AccessViolation(message_fmt=DEF_NO_LIST_ACCESS_MSG)
  1952       raise out_of_band.AccessViolation(message_fmt=DEF_NO_LIST_ACCESS_MSG)
  1954 
  1953 
  1973 
  1972 
  1974     prefix = get_args['prefix']
  1973     prefix = get_args['prefix']
  1975     django_args['prefix'] = prefix
  1974     django_args['prefix'] = prefix
  1976     django_args['scope_path'] = get_args['scope_path']
  1975     django_args['scope_path'] = get_args['scope_path']
  1977 
  1976 
  1978     checker = rights_logic.Checker(prefix)
  1977     checker = callback.getCore().getRightsChecker(prefix)
  1979     memberships = checker.getMemberships()
  1978     memberships = checker.getMemberships()
  1980 
  1979 
  1981     roles = []
  1980     roles = []
  1982     for key, value in memberships.iteritems():
  1981     for key, value in memberships.iteritems():
  1983       if self.hasMembership(value, django_args):
  1982       if self.hasMembership(value, django_args):