/usr/lib/python3/dist-packages/rules/permissions.py is in python3-django-rules 1.3.0-1.
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 25 26 27 28 29 30 31 | from .rulesets import RuleSet
permissions = RuleSet()
def add_perm(name, pred):
permissions.add_rule(name, pred)
def remove_perm(name):
permissions.remove_rule(name)
def perm_exists(name):
return permissions.rule_exists(name)
def has_perm(name, *args, **kwargs):
return permissions.test_rule(name, *args, **kwargs)
class ObjectPermissionBackend(object):
def authenticate(self, username, password):
return None
def has_perm(self, user, perm, *args, **kwargs):
return has_perm(perm, user, *args, **kwargs)
def has_module_perms(self, user, app_label):
return has_perm(app_label, user)
|