summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/api/events.js11
-rw-r--r--server/api/roles.js14
-rw-r--r--webapp/src/components/EventModuleEdit.vue2
-rw-r--r--webapp/src/components/PermissionModuleEdit.vue2
4 files changed, 21 insertions, 8 deletions
diff --git a/server/api/events.js b/server/api/events.js
index 310a64a..4fcbda9 100644
--- a/server/api/events.js
+++ b/server/api/events.js
@@ -19,8 +19,8 @@ router.all(['', '/:x'], async (req, res, next) => {
break
case 'POST':
- // TODO: REMOVE blacklist free pass IF PM uses own blacklist function --> HELPER LIB?!
- if (req.params.x === 'blacklist') break
+ // TODO: Add Group-Permission check
+ if (req.params.x === 'getChilds') break
if (!await req.user.hasPermission('events.edit')) return res.status(403).send({ error: 'Missing permission', permission: 'events.edit' })
break
@@ -58,12 +58,11 @@ router.getAsync('', async (req, res) => {
/*
* @return: Returns a list of all childs of the given groups
- * Is also used by the PermissionManager Frontend to get it's blacklist childs
*/
-router.postAsync('/blacklist', async (req, res) => {
+router.postAsync('/getChilds', async (req, res) => {
if (req.body.groups) {
- var blacklist = await groupHelper.getAllChildren(req.body.groups)
- res.send(blacklist)
+ var childs = await groupHelper.getAllChildren(req.body.groups)
+ res.send(childs)
} else res.status(404).end()
})
diff --git a/server/api/roles.js b/server/api/roles.js
index ba1c2a2..d98811a 100644
--- a/server/api/roles.js
+++ b/server/api/roles.js
@@ -1,6 +1,7 @@
/* global __appdir */
var path = require('path')
var db = require(path.join(__appdir, 'lib', 'sequelize'))
+var groupHelper = require(path.join(__appdir, 'lib', 'grouphelper'))
var express = require('express')
const { decorateApp } = require('@awaitjs/express')
var router = decorateApp(express.Router())
@@ -15,6 +16,9 @@ router.all(['', '/:x'], async (req, res, next) => {
break
case 'POST':
+ // TODO: Add Group-Permission check
+ if (req.params.x === 'getChilds') break
+
if (!await req.user.hasPermission('roles.edit')) return res.status(403).send({ error: 'Missing permission', permission: 'roles.edit' })
break
@@ -165,4 +169,14 @@ router.postAsync(['', '/:id'], async (req, res) => {
}
})
+/*
+ * @return: Returns a list of all childs of the given groups
+ */
+router.postAsync('/getChilds', async (req, res) => {
+ if (req.body.groups) {
+ var childs = await groupHelper.getAllChildren(req.body.groups)
+ res.send(childs)
+ } else res.status(404).end()
+})
+
module.exports.router = router
diff --git a/webapp/src/components/EventModuleEdit.vue b/webapp/src/components/EventModuleEdit.vue
index c079ee5..c5aabe1 100644
--- a/webapp/src/components/EventModuleEdit.vue
+++ b/webapp/src/components/EventModuleEdit.vue
@@ -631,7 +631,7 @@ export default {
},
async loadChilds () {
if (this.groups.length > 0) {
- var response = await this.$http.post('/api/events/blacklist', { groups: this.groups })
+ var response = await this.$http.post('/api/events/getChilds', { groups: this.groups })
this.blackgroupList = response.data.subgroups
this.blackclientList = response.data.clients
this.blacklistGroups = this.blacklistGroups.filter(g => this.blackgroupList.map(x => x.id).indexOf(g.id) !== -1)
diff --git a/webapp/src/components/PermissionModuleEdit.vue b/webapp/src/components/PermissionModuleEdit.vue
index 85102b5..198bacf 100644
--- a/webapp/src/components/PermissionModuleEdit.vue
+++ b/webapp/src/components/PermissionModuleEdit.vue
@@ -205,7 +205,7 @@ export default {
},
async loadChilds () {
if (this.groups.length > 0) {
- var response = await this.$http.post('/api/events/blacklist', { groups: this.groups })
+ var response = await this.$http.post('/api/roles/getChilds', { groups: this.groups })
this.blacklistList = response.data.subgroups
this.blacklist = this.blacklist.filter(g => this.blacklistList.map(x => x.id).indexOf(g.id) !== -1)
} else {