Пример #1
0
 def can_administrate(self):
     if users.is_webmaster(self._user):
         return True
     if self._user and self._user == self._group.owner:
         return True
     if self._member and self._member.is_approved:
         return self._member.role == Member.ADMINISTRATOR
     return False
Пример #2
0
 def can_edit(self):
     if users.is_webmaster(self._user):
         return True
     if self._user and self._user.is_staff:
         return True
     if self._user and self._resto.owner:
         return self._user == self._resto.owner
     return False
def current_user_processor(request):
    user = users.get_current_user(request)
    if not user:
        login_url = users.create_login_url(request.path)
        logout_url = None
    else:
        login_url = None
        logout_url = users.create_logout_url(request.path)
    return {
        "user_": user,
        "user_ip_": request.META["REMOTE_ADDR"],
        "login_url_": login_url,
        "logout_url_": logout_url,
        "is_webmaster_": users.is_webmaster(user),
    }
Пример #4
0
 def _check_create_access(self):
     if not users.is_webmaster(self.current_user):
         message = "Only webmaster can create new groups."
         logging.error(message)
         raise BadRequestError(self.request, message)
Пример #5
0
 def can_delete(self):
     if not self._user:
         return False
     if users.is_webmaster(self._user):
         return True
     return (self._activity.submitter == self._user)
Пример #6
0
 def process(self):
     if not users.is_webmaster(self.current_user):
         message = "The action '%s' is restricted to webmasters." % self.name
         raise BadRequestError(self.request, message)
     else:
         return super(WebmasterAction, self).process()
Пример #7
0
 def _check_create_access(self):
     if not users.is_webmaster(self.current_user):
         message = "Current user cannot add an inductee."
         raise BadRequestError(self.request, message)
Пример #8
0
 def _check_edit_access(self):
     if not users.is_webmaster(self.current_user):
         message = "Current user cannot change photo of inductee."
         raise BadRequestError(self.request, message)
Пример #9
0
 def _check_migrate_access(self):
     if not users.is_webmaster(self.current_user):
         message = "Current user cannot migrate model."
         raise BadRequestError(self.request, message)
Пример #10
0
 def can_delete(self):
     if users.is_webmaster(self._user):
         return True
     if self._user and self._resto.owner:
         return self._user == self._resto.owner
     return False