'Checks permissions on a given object for a given mode'

def has_permission(self, obj, mode='r'):

    if (self.is_admin() or (not obj)):
        return True
    for imode in mode:
        if (not self._check_permission(obj, imode)):
            return False
    return True
