def is_authenticated(self, request, **kwargs): if request.user.is_authenticated: return True # Allow access to the API of no root password has been set yet if not bsdUsers.has_root_password(): return True return False
def is_authenticated(self, request, **kwargs): if request.user.is_authenticated(): return True # Allow access to the API of no root password has been set yet if not bsdUsers.has_root_password(): return True return False
def is_webclient(self, request): # Do not treat passwordless API auth as webclient if not bsdUsers.has_root_password(): return None if (request.META.get('HTTP_X_REQUESTED_FROM') == 'WebUI' or not request.META.get('HTTP_AUTHORIZATION', '').startswith('Basic')): return True
def is_webclient(self, request): # Do not treat passwordless API auth as webclient if not bsdUsers.has_root_password(): return None if ( request.META.get('HTTP_X_REQUESTED_FROM') == 'WebUI' or not request.META.get('HTTP_AUTHORIZATION', '').startswith('Basic') ): return True