feat: admin - manage groups + permissions + page rules
This commit is contained in:
@@ -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.')
|
||||
}
|
||||
|
@@ -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()
|
||||
|
@@ -37,6 +37,8 @@ type GroupMutation {
|
||||
update(
|
||||
id: Int!
|
||||
name: String!
|
||||
permissions: [String]!
|
||||
pageRules: [PageRuleInput]!
|
||||
): DefaultResponse @auth(requires: ["write:groups", "manage:groups", "manage:system"])
|
||||
|
||||
delete(
|
||||
@@ -77,8 +79,46 @@ type Group {
|
||||
name: String!
|
||||
isSystem: Boolean!
|
||||
permissions: [String]!
|
||||
pageRules: [Right]
|
||||
pageRules: [PageRule]
|
||||
users: [UserMinimal]
|
||||
createdAt: Date!
|
||||
updatedAt: Date!
|
||||
}
|
||||
|
||||
type PageRule {
|
||||
id: String!
|
||||
deny: Boolean!
|
||||
match: PageRuleMatch!
|
||||
roles: [PageRuleRole]!
|
||||
path: String!
|
||||
locales: [String]!
|
||||
}
|
||||
|
||||
input PageRuleInput {
|
||||
id: String!
|
||||
deny: Boolean!
|
||||
match: PageRuleMatch!
|
||||
roles: [PageRuleRole]!
|
||||
path: String!
|
||||
locales: [String]!
|
||||
}
|
||||
|
||||
enum PageRuleRole {
|
||||
READ
|
||||
WRITE
|
||||
MANAGE
|
||||
DELETE
|
||||
AS_READ
|
||||
AS_WRITE
|
||||
AS_MANAGE
|
||||
CM_READ
|
||||
CM_WRITE
|
||||
CM_MANAGE
|
||||
}
|
||||
|
||||
enum PageRuleMatch {
|
||||
START
|
||||
EXACT
|
||||
END
|
||||
REGEX
|
||||
}
|
||||
|
@@ -44,6 +44,7 @@ type SystemInfo {
|
||||
nodeVersion: String
|
||||
operatingSystem: String
|
||||
pagesTotal: Int
|
||||
platform: String
|
||||
ramTotal: String
|
||||
redisHost: String
|
||||
redisTotalRAM: String
|
||||
|
Reference in New Issue
Block a user