Пример #1
0
    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
Пример #2
0
    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
Пример #3
0
    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
Пример #4
0
    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