mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	removed no-login option since it wasn't working with the new django version anyway.
This commit is contained in:
		@@ -129,11 +129,6 @@ PAPERLESS_EMAIL_SECRET=""
 | 
			
		||||
# https://docs.djangoproject.com/en/1.11/ref/settings/#force-script-name
 | 
			
		||||
#PAPERLESS_FORCE_SCRIPT_NAME=""
 | 
			
		||||
 | 
			
		||||
# If you are using alternative authentication means or are just using paperless
 | 
			
		||||
# as a single user on a small private network, this option allows you to disable
 | 
			
		||||
# user authentication if you set it to "true"
 | 
			
		||||
#PAPERLESS_DISABLE_LOGIN="false"
 | 
			
		||||
 | 
			
		||||
###############################################################################
 | 
			
		||||
####                          Software Tweaks                              ####
 | 
			
		||||
###############################################################################
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
from django.utils.deprecation import MiddlewareMixin
 | 
			
		||||
from .models import User
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Middleware(MiddlewareMixin):
 | 
			
		||||
    """
 | 
			
		||||
      This is a dummy authentication middleware class that creates what
 | 
			
		||||
      is roughly an Anonymous authenticated user so we can disable login
 | 
			
		||||
      and not interfere with existing user ID's. It's only used if
 | 
			
		||||
      login is disabled in paperless.conf (default is to require login)
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def process_request(self, request):
 | 
			
		||||
        request.user = User()
 | 
			
		||||
@@ -1,31 +0,0 @@
 | 
			
		||||
from django.contrib.auth.models import User as DjangoUser
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class User:
 | 
			
		||||
    """
 | 
			
		||||
    This is a dummy django User used with our middleware to disable
 | 
			
		||||
    login authentication if that is configured in paperless.conf
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    is_superuser = True
 | 
			
		||||
    is_active = True
 | 
			
		||||
    is_staff = True
 | 
			
		||||
    is_authenticated = True
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def id(self):
 | 
			
		||||
        return DjangoUser.objects.order_by("pk").first().pk
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def pk(self):
 | 
			
		||||
        return self.id
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
NOTE: These are here as a hack instead of being in the User definition
 | 
			
		||||
NOTE: above due to the way pycodestyle handles lamdbdas.
 | 
			
		||||
NOTE: See https://github.com/PyCQA/pycodestyle/issues/379 for more.
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
User.has_module_perms = lambda *_: True
 | 
			
		||||
User.has_perm = lambda *_: True
 | 
			
		||||
@@ -140,11 +140,6 @@ if DEBUG:
 | 
			
		||||
    # Allow access from the angular development server during debugging
 | 
			
		||||
    CORS_ORIGIN_WHITELIST += ('http://localhost:4200',)
 | 
			
		||||
 | 
			
		||||
# If auth is disabled, we just use our "bypass" authentication middleware
 | 
			
		||||
if bool(os.getenv("PAPERLESS_DISABLE_LOGIN", "false").lower() in ("yes", "y", "1", "t", "true")):
 | 
			
		||||
    _index = MIDDLEWARE.index("django.contrib.auth.middleware.AuthenticationMiddleware")
 | 
			
		||||
    MIDDLEWARE[_index] = "paperless.middleware.Middleware"
 | 
			
		||||
 | 
			
		||||
# The secret key has a default that should be fine so long as you're hosting
 | 
			
		||||
# Paperless on a closed network.  However, if you're putting this anywhere
 | 
			
		||||
# public, you should change the key to something unique and verbose.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user