Added /clearpermiss started /testing

This commit is contained in:
Naida Vatric
2019-10-31 14:27:46 +01:00
parent 2193428609
commit 03a7086162
4 changed files with 130 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
//Checking if user is a member of a group
//if yes returns true else returns false
const checkMember = (requser, reqgroup, db) => {
let check;
db.transaction (trx => {
trx.select('username')
.from('groups')
.where('username', 'ilike', requser)
.andWhere('groupname', 'ilike', reqgroup)
.then ( data => {
if (data.length!==0) {
check= true;
}
check= false;
})
.then(trx.commit)
.catch(trx.rollback)
});
console.log ('check', check);
return check;
}
module.exports = {
checkMember
}