Added frond-end and needed get calls.

This commit is contained in:
Naida Vatric
2019-11-07 01:10:25 +01:00
parent 0d525d486e
commit 54aad28c5f
30 changed files with 14267 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
//Call for listing all groups with their permissions - needed for control panel
//Groups without permissions also included
//
const handleListPerm = (req, res, db) => {
db.transaction ( trx => {
trx.select('groups.groupname', 'permissions.objname', 'permissions.type')
.from('groups')
.leftJoin('permissions', function () {
this.on('groups.groupname', 'ilike','permissions.owner')
})
.where('username', 'like', '')
.orderBy('groupname', 'asc')
.orderBy('objname', 'asc')
.then ( data => {
res.json(data);
})
.then(trx.commit)
.catch(trx.rollback)
.catch (err => res.status(400).json('Error accesing database.'))
})
}
module.exports = {
handleListPerm
}