From 8b7ebc99c3f44c4e519d6cb402094c438d9339f3 Mon Sep 17 00:00:00 2001 From: Andrew DeVries Date: Fri, 14 Apr 2023 13:10:58 -0400 Subject: [PATCH] Bug Fixes --- installScripts/manualInstall.md | 24 ++++++++++- .../detectdfs/widgets/detectdfs/detectdfs.htm | 40 ++++++++++--------- uispToolsApiHandler.js | 2 +- uispToolsApiRequestHandler.js | 33 ++++++++++----- 4 files changed, 68 insertions(+), 31 deletions(-) diff --git a/installScripts/manualInstall.md b/installScripts/manualInstall.md index 48b274b..115c21b 100644 --- a/installScripts/manualInstall.md +++ b/installScripts/manualInstall.md @@ -2,11 +2,33 @@ sudo passwd unms #Login as unms +sudo su unms cd ~ cd app ./unms-cli stop # append uisp_tools docker Compose to docker-compose.yml +# add uisptools as a depends on to unms service so starts and stops with unms +# - uisptools +nano /home/unms/app/docker-compose.yml -''' \ No newline at end of file +''' + +#Edit nginx template to add uisptools + +``` +docker exec -it unms-nginx sh +ls /usr/local/openresty/nginx/conf/conf.d +#edit the template for file listed +vi /usr/local/openresty/nginx/templates/conf.d/unms+ucrm-https+wss.conf.template + + location /uisptools/ { + allow all; + proxy_pass http://uisptools:49080; + } + +docker restart unms-nginx +``` + +#now you should be able to visit unms url /uisptools \ No newline at end of file diff --git a/plugins/uisptools/detectdfs/widgets/detectdfs/detectdfs.htm b/plugins/uisptools/detectdfs/widgets/detectdfs/detectdfs.htm index bab4825..1a27919 100644 --- a/plugins/uisptools/detectdfs/widgets/detectdfs/detectdfs.htm +++ b/plugins/uisptools/detectdfs/widgets/detectdfs/detectdfs.htm @@ -3,25 +3,27 @@
- - - - - - - - - - - - - - - - - - -
NAMEIP ADDRESSTYPEMODELLINK NAMEFREQUENCYSTATIONSLINKSTATUSAction
+
+ + + + + + + + + + + + + + + + + + +
NAMEIP ADDRESSTYPEMODELLINK NAMEFREQUENCYSTATIONSLINKSTATUSAction
+
diff --git a/uispToolsApiHandler.js b/uispToolsApiHandler.js index 46d60f3..28e3765 100644 --- a/uispToolsApiHandler.js +++ b/uispToolsApiHandler.js @@ -695,7 +695,7 @@ var UispToolsApiHandler = function (options) { deferred.reject(ex); } }, - function(err){ + function(ex){ debug('error', 'getPageContent', ex); deferred.reject(ex); } diff --git a/uispToolsApiRequestHandler.js b/uispToolsApiRequestHandler.js index c1cafd8..19abdc3 100644 --- a/uispToolsApiRequestHandler.js +++ b/uispToolsApiRequestHandler.js @@ -146,32 +146,45 @@ var UispToolsApiRequestHandler = function (options) { }, function(err){ debug("error", "checkApiAccess Error", { "msg": err.message, "stack": err }); - res.status(500).json({ "msg": "An Error Occured!", "error": err}); + if(res.closed === false){ + res.status(500).json({ "msg": "An Error Occured!", "error": err}); + } } ) }else{ debug("debug", "checkApiAccess access_token is invalid", req.headers.authorization); - res.status(401).json({ "msg": "Invalid AccessToken!", "error": "Invalid AccessToken"}); + if(res.closed === false){ + res.status(401).json({ "msg": "Invalid AccessToken!", "error": "Invalid AccessToken"}); + } } } catch (ex) { debug("error", "checkApiAccess", { "msg": ex.message, "stack": ex.stack }); - res.status(500).json({ "msg": "An Error Occured!", "error": ex }); + if(res.closed === false){ + res.status(500).json({ "msg": "An Error Occured!", "error": ex }); + } } } var checkSuperAdminApiAccess = function (req, res, next) { try { - if(res.locals.accessToken == undefined){ - checkApiAccess(req,res) + let isSuperAdminNext = function(){ + if(res.locals.accessToken && res.locals.accessToken.loginData.userType === "nms" && res.locals.accessToken.loginData.nmsLoginData.role === "superadmin" ){ + if(next !== undefined || next !== null){ + next("route") + } + }else{ + debug("debug", "checkSuperAdminApiAccess", "Not Super Admin", req.headers.authorization); + res.status(403).json({ "msg": "Invalid AccessToken Not Super Admin!", "error": "Invalid AccessToken Not Super Admin"}); + } } - - if(res.locals.accessToken && res.locals.accessToken.loginData.userType === "nms" && res.locals.accessToken.loginData.nmsLoginData.role === "superadmin" ){ - next("route") + + if(res.locals.accessToken == undefined){ + checkApiAccess(req,res,isSuperAdminNext) }else{ - debug("debug", "checkSuperAdminApiAccess", "Not Super Admin", req.headers.authorization); - res.status(403).json({ "msg": "Invalid AccessToken Not Super Admin!", "error": "Invalid AccessToken Not Super Admin"}); + + isSuperAdminNext(); }