def ensure_audit_security(perm_arg):
    def _wrapper(f):
        def _decorator(self, *args, **kwargs):
            if not any([name == AUDIT_SECURITY and argument == perm_arg for name, argument, _, _
                    in self.current_user.my_permissions()]):
                return self.forbidden()

            return f(self, *args, **kwargs)

        return wraps(f)(_decorator)

    return _wrapper
Edit preserves the original creator of the badge (bugfix)
dataset/ETHPy150Open dropbox/grouper/grouper/fe/util.py/ensure_audit_security--crossover with--dataset/ETHPy150Open mozilla/django-badger/badger/tests/test_views.py/BadgerViewsTest.test_edit_preserves_creator