Ticket #12441: 12441.diff
File 12441.diff, 1.9 KB (added by , 15 years ago) |
---|
-
django/contrib/admin/sites.py
141 141 """ 142 142 return request.user.is_authenticated() and request.user.is_staff 143 143 144 def has_module_perms(self, request, app_label): 145 """ 146 Returns True if the given HttpRequest has permission to view 147 given application admin site. 148 """ 149 return request.user.has_module_perms(app_label) 150 144 151 def check_dependencies(self): 145 152 """ 146 153 Check that all things needed to run the admin have been correctly installed. … … 336 343 apps that have been registered in this site. 337 344 """ 338 345 app_dict = {} 339 user = request.user340 346 for model, model_admin in self._registry.items(): 341 347 app_label = model._meta.app_label 342 has_module_perms = user.has_module_perms(app_label)348 has_module_perms = self.has_module_perms(request, app_label) 343 349 344 350 if has_module_perms: 345 351 perms = model_admin.get_model_perms(request) … … 397 403 ) 398 404 399 405 def app_index(self, request, app_label, extra_context=None): 400 user = request.user 401 has_module_perms = user.has_module_perms(app_label) 406 has_module_perms = self.has_module_perms(request, app_label) 402 407 app_dict = {} 403 for model, model_admin in self._registry.items():404 if app_label == model._meta.app_label:405 if has_module_perms:408 if has_module_perms: 409 for model, model_admin in self._registry.items(): 410 if app_label == model._meta.app_label: 406 411 perms = model_admin.get_model_perms(request) 407 412 408 413 # Check whether user has any perm for this module.