Added /clearpermiss started /testing
This commit is contained in:
24
helpfunctions/checkmemb.js
Normal file
24
helpfunctions/checkmemb.js
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user