mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	scripts: Make manage.py use root checking from zulip_tools.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							0975bbb39e
						
					
				
				
					commit
					cfe603f342
				
			@@ -6,11 +6,10 @@ import types
 | 
				
			|||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
 | 
					BASE_DIR = os.path.dirname(os.path.abspath(__file__))
 | 
				
			||||||
sys.path.append(BASE_DIR)
 | 
					sys.path.append(BASE_DIR)
 | 
				
			||||||
import scripts.lib.setup_path_on_import
 | 
					import scripts.lib.setup_path_on_import
 | 
				
			||||||
 | 
					from scripts.lib.zulip_tools import script_should_not_be_root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
    if 'posix' in os.name and os.geteuid() == 0:
 | 
					    script_should_not_be_root()
 | 
				
			||||||
        print("manage.py should not be run as root.  Use `su zulip` to drop root.")
 | 
					 | 
				
			||||||
        sys.exit(1)
 | 
					 | 
				
			||||||
    if (os.access('/etc/zulip/zulip.conf', os.R_OK) and not
 | 
					    if (os.access('/etc/zulip/zulip.conf', os.R_OK) and not
 | 
				
			||||||
            os.access('/etc/zulip/zulip-secrets.conf', os.R_OK)):
 | 
					            os.access('/etc/zulip/zulip-secrets.conf', os.R_OK)):
 | 
				
			||||||
        # The best way to detect running manage.py as another user in
 | 
					        # The best way to detect running manage.py as another user in
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user