Ticket #10609: action_permissions.patch

File action_permissions.patch, 754 bytes (added by leitjohn, 16 years ago)

patch

  • options.py

     
    423423        for klass in [self.admin_site] + self.__class__.mro()[::-1]:
    424424            for action in getattr(klass, 'actions', []):
    425425                func, name, description = self.get_action(action)
    426                 actions[name] = (func, name, description)
     426               
     427                # check permission
     428                test = getattr(func, "test_func", None)
     429                if test == None or test(request.user):
     430                    actions[name] = (func, name, description)
    427431        return actions
    428432
    429433    def get_action_choices(self, request=None, default_choices=BLANK_CHOICE_DASH):
Back to Top