mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
				synced 2025-11-03 20:27:45 +00:00 
			
		
		
		
	Only allowing root users to run scripts.
This commit is contained in:
		@@ -236,8 +236,12 @@ namespace OpenWifi {
 | 
			
		||||
 | 
			
		||||
	void RESTAPI_device_commandHandler::Script() {
 | 
			
		||||
		Logger_.information(fmt::format("SCRIPT: user={} serial={}", UserInfo_.userinfo.email,SerialNumber_));
 | 
			
		||||
		const auto &Obj = ParsedBody_;
 | 
			
		||||
 | 
			
		||||
		if(!Internal_ && UserInfo_.userinfo.userRole!=SecurityObjects::ROOT) {
 | 
			
		||||
			return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const auto &Obj = ParsedBody_;
 | 
			
		||||
		GWObjects::ScriptRequest	SCR;
 | 
			
		||||
		if(!SCR.from_json(Obj)) {
 | 
			
		||||
			return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user