mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Rejiggering for more pycodestyle issues...
This commit is contained in:
		| @@ -1,6 +1,7 @@ | |||||||
| from django.utils.deprecation import MiddlewareMixin | from django.utils.deprecation import MiddlewareMixin | ||||||
| from .models import User | from .models import User | ||||||
|  |  | ||||||
|  |  | ||||||
| class Middleware (MiddlewareMixin): | class Middleware (MiddlewareMixin): | ||||||
|     """ |     """ | ||||||
|       This is a dummy authentication middleware class that creates what |       This is a dummy authentication middleware class that creates what | ||||||
| @@ -11,4 +12,3 @@ class Middleware (MiddlewareMixin): | |||||||
|  |  | ||||||
|     def process_request(self, request): |     def process_request(self, request): | ||||||
|         request.user = User() |         request.user = User() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,13 +7,20 @@ class User: | |||||||
|     is_active = True |     is_active = True | ||||||
|     is_staff = True |     is_staff = True | ||||||
|     is_authenticated = True |     is_authenticated = True | ||||||
|     has_module_perms = lambda *_: True |  | ||||||
|     has_perm = lambda *_: True |  | ||||||
|  |  | ||||||
|     #Must be -1 to avoid colliding with real user ID's (which start at 1) |     # Must be -1 to avoid colliding with real user ID's (which start at 1) | ||||||
|     id = -1 |     id = -1 | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def pk(self): |     def pk(self): | ||||||
|         return self.id |         return self.id | ||||||
|  |  | ||||||
|  |  | ||||||
|  | """ | ||||||
|  |   NOTE: These are here as a hack instead of being in the User definition | ||||||
|  |   above due to the way pycodestyle handles lamdbdas. | ||||||
|  |   See https://github.com/PyCQA/pycodestyle/issues/379 for more. | ||||||
|  | """ | ||||||
|  |  | ||||||
|  | User.has_module_perms = lambda *_: True | ||||||
|  | User.has_perm = lambda *_: True | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matt
					Matt