Exemplo n.º 1
0
 def test_func(self):
     user = self.request.user
     mlist_id = self.kwargs['list_id']
     if user.is_superuser:
         return True
     set_list_access_props(user, mlist_id)
     return user.is_list_owner or user.is_list_moderator
Exemplo n.º 2
0
 def dispatch(self, request, *args, **kwargs):
     # get the list object.
     if 'list_id' in kwargs:
         self.mailing_list = self._get_list(kwargs['list_id'],
                                            int(kwargs.get('page', 1)))
         set_list_access_props(request.user, self.mailing_list)
     # set the template
     if 'template' in kwargs:
         self.template = kwargs['template']
     return super(MailingListView, self).dispatch(request, *args, **kwargs)
Exemplo n.º 3
0
 def wrapper(*args, **kwargs):
     user = args[0].user
     list_id = kwargs['list_id']
     if not user.is_authenticated:
         raise PermissionDenied
     if user.is_superuser:
         return fn(*args, **kwargs)
     set_list_access_props(user, list_id)
     if user.is_list_owner or user.is_list_moderator:
         return fn(*args, **kwargs)
     else:
         raise PermissionDenied