'Checks if user/group has given permission for object.
:param perm: permission as string, may or may not contain app_label
prefix (if not prefixed, we grab app_label from ``obj``)
:param obj: Django model instance for which permission should be checked'

def has_perm(self, perm, obj):

    if (self.user and (not self.user.is_active)):
        return False
    elif (self.user and self.user.is_superuser):
        return True
    perm = perm.split(u'.')[(-1)]
    return (perm in self.get_perms(obj))
