summaryrefslogtreecommitdiffstats
path: root/server/api/permissions.js
diff options
context:
space:
mode:
authorJannik Schönartz2018-07-02 21:52:25 +0200
committerJannik Schönartz2018-07-02 21:52:25 +0200
commitaa4e552a03657a63922f5cd085431257c183f458 (patch)
treefc8cd63129bb54b06326c11847a9731fe70f1b33 /server/api/permissions.js
downloadbas-aa4e552a03657a63922f5cd085431257c183f458.tar.gz
bas-aa4e552a03657a63922f5cd085431257c183f458.tar.xz
bas-aa4e552a03657a63922f5cd085431257c183f458.zip
[server] Initial commit to add the node server stuff.
Diffstat (limited to 'server/api/permissions.js')
-rw-r--r--server/api/permissions.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/api/permissions.js b/server/api/permissions.js
new file mode 100644
index 0000000..bf24462
--- /dev/null
+++ b/server/api/permissions.js
@@ -0,0 +1,28 @@
+/* global __appdir */
+var path = require('path');
+var db = require(path.join(__appdir, 'lib', 'sequelize'));
+
+module.exports = {
+ // Return ID, Description and Name of a given RoleID
+ getRoleById: function(req, res) {
+ var roleid = req.params.roleid;
+ db.role.findById(roleid).then(role_db => {
+ var role = { };
+ role.id = role_db.id;
+ role.descr = role_db.descr;
+ role.name = role_db.name;
+ res.status(200).send(role);
+ });
+ },
+ // Return all RoleIDs associated to a given UserID
+ getRolesByUserid: function(req, res) {
+ // var userid = req.query.userid;
+ // the usersxroles (and rolesxpermissions) models first have to get created
+ /* db.usersxroles.findAndCountAll({ where: { id: userid }, attributes: ['roleid'] }).then(roles_db => {
+ var result = { };
+ result.count = roles_db.count;
+ result.roles = roles_db.rows;
+ res.status(200).send(result);
+ });*/
+ }
+} \ No newline at end of file