/usr/lib/python2.7/dist-packages/guardian/management/commands/clean_orphan_obj_perms.py is in python-django-guardian 1.2.4+git20141127-0.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from __future__ import unicode_literals
from django.core.management.base import NoArgsCommand
from guardian.utils import clean_orphan_obj_perms
class Command(NoArgsCommand):
"""
clean_orphan_obj_perms command is a tiny wrapper around
:func:`guardian.utils.clean_orphan_obj_perms`.
Usage::
$ python manage.py clean_orphan_obj_perms
Removed 11 object permission entries with no targets
"""
help = "Removes object permissions with not existing targets"
def handle_noargs(self, **options):
removed = clean_orphan_obj_perms()
if options['verbosity'] > 0:
print("Removed %d object permission entries with no targets" %
removed)
|