mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Updating changes to allow for disabling login
This commit is contained in:
		| @@ -1,10 +1,18 @@ | ||||
| from django.contrib.auth.models import User | ||||
|  | ||||
| ''' | ||||
|   This is a dummy authentication middleware module that creates what  | ||||
|   is roughly an Anonymous authenticated user so we can disable login | ||||
|   and not interfere with existing user ID's. | ||||
| ''' | ||||
|  | ||||
| class User: | ||||
|     is_superuser = True | ||||
|     is_active = True | ||||
|     is_staff = True | ||||
|     id = 1 | ||||
|     is_authenticated=True | ||||
|     id = -1 #Must be -1 to avoid colliding with possible existing user ID's (that start number at 1) | ||||
|     pk = -1 | ||||
|  | ||||
| def return_true(*args, **kwargs): | ||||
|     return True | ||||
|   | ||||
| @@ -78,12 +78,14 @@ if os.getenv("PAPERLESS_INSTALLED_APPS"): | ||||
|     INSTALLED_APPS += os.getenv("PAPERLESS_INSTALLED_APPS").split(",") | ||||
|  | ||||
|  | ||||
| #Default Django authentication middleware (requires a username/password) | ||||
| AUTH_CLASSES = [\ | ||||
|     'django.contrib.auth.middleware.AuthenticationMiddleware', | ||||
|     'django.contrib.auth.middleware.SessionAuthenticationMiddleware'] | ||||
|  | ||||
| if bool(os.getenv("PAPERLESS_DISABLE_AUTH","true").lower() in ("yes", "y", "1", "t", "true")): | ||||
|   AUTH_CLASSES = ['auto_auth.Middleware']    | ||||
| #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")):   | ||||
|   AUTH_CLASSES = ['paperless.auto_auth.Middleware']    | ||||
|  | ||||
| MIDDLEWARE_CLASSES = [ | ||||
|     'django.middleware.security.SecurityMiddleware', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matt Meno
					Matt Meno