Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewiski committed Apr 14, 2023
1 parent 6aca38b commit 8b7ebc9
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 31 deletions.
24 changes: 23 additions & 1 deletion installScripts/manualInstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


'''
'''

#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
40 changes: 21 additions & 19 deletions plugins/uisptools/detectdfs/widgets/detectdfs/detectdfs.htm
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
<div class="row">
<div>
<div class="col-md-12">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">NAME</th>
<th scope="col">IP ADDRESS</th>
<th scope="col">TYPE</th>
<th scope="col">MODEL</th>
<th scope="col">LINK NAME</th>
<th scope="col">FREQUENCY</th>
<th scope="col">STATIONS</th>
<th scope="col">LINK</th>
<th scope="col">STATUS</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody class="deviceList">

</tbody>
</table>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">NAME</th>
<th scope="col">IP ADDRESS</th>
<th scope="col">TYPE</th>
<th scope="col">MODEL</th>
<th scope="col">LINK NAME</th>
<th scope="col">FREQUENCY</th>
<th scope="col">STATIONS</th>
<th scope="col">LINK</th>
<th scope="col">STATUS</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody class="deviceList">

</tbody>
</table>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion uispToolsApiHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ var UispToolsApiHandler = function (options) {
deferred.reject(ex);
}
},
function(err){
function(ex){
debug('error', 'getPageContent', ex);
deferred.reject(ex);
}
Expand Down
33 changes: 23 additions & 10 deletions uispToolsApiRequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


Expand Down

0 comments on commit 8b7ebc9

Please sign in to comment.