<commit_before>from guardian.backends import ObjectPermissionBackend
from guardian.core import ObjectPermissionChecker

class PermissionBackend(ObjectPermissionBackend):
    def has_perm(self, user_obj, perm, obj=None):
        if (super(PermissionBackend, self).has_perm(user_obj, 'no_access_to_nodegroup', obj)):
            return False
        obj_perm = super(PermissionBackend, self).has_perm(user_obj, perm, obj)

        if obj_perm:
            return True
        else:
            default_perms = []<commit_msg>fix has_perm logic, re #1636<commit_after>from guardian.backends import ObjectPermissionBackend
from guardian.shortcuts import get_user_perms

class PermissionBackend(ObjectPermissionBackend):
    def has_perm(self, user_obj, perm, obj=None):
        user_defined_perms = get_user_perms(user_obj, obj)
        if len(user_defined_perms) > 0:
            if 'no_access_to_nodegroup' in user_defined_perms:
                return False
            else:
                return perm in user_defined_perms
        else:
            default_perms = []
{'fraction_non_alphanumeric': 0.0702247191011236, 'fraction_numerical': 0.0046816479400749065, 'mean_word_length': 3.2086614173228347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5510705', 'n_tokens_mistral': 309, 'n_tokens_neox': 304, 'n_words': 71}