feat: admin - manage groups + permissions + page rules

This commit is contained in:
Nicolas Giard
2018-12-29 21:30:51 -05:00
parent 10940ca230
commit edb97b832d
36 changed files with 1116 additions and 958 deletions

View File

@@ -41,6 +41,7 @@ module.exports = {
const group = await WIKI.models.groups.query().insertAndFetch({
name: args.name,
permissions: JSON.stringify(WIKI.data.groups.defaultPermissions),
pageRules: JSON.stringify([]),
isSystem: false
})
return {
@@ -69,7 +70,11 @@ module.exports = {
}
},
async update(obj, args) {
await WIKI.models.groups.query().patch({ name: args.name }).where('id', args.id)
await WIKI.models.groups.query().patch({
name: args.name,
permissions: JSON.stringify(args.permissions),
pageRules: JSON.stringify(args.pageRules)
}).where('id', args.id)
return {
responseResult: graphHelper.generateSuccess('Group has been updated.')
}

View File

@@ -77,11 +77,14 @@ module.exports = {
const osInfo = await getos()
osLabel = `${os.type()} - ${osInfo.dist} (${osInfo.codename || os.platform()}) ${osInfo.release || os.release()} ${os.arch()}`
}
return osLabel
},
async platform () {
const isDockerized = await fs.pathExists('/.dockerenv')
if (isDockerized) {
osLabel = `${osLabel} (Docker Container)`
return 'docker'
}
return osLabel
return os.platform()
},
hostname() {
return os.hostname()