WritheM / Wallace

https://plug.dj/writhem-radio
Other
4 stars 3 forks source link

New permission system #62

Open ylt opened 9 years ago

ylt commented 9 years ago

Current system isn't particularly clean and isn't very flexible, Go with a nodes approach.

Nodes can be defined in a form like: [plugin].[command](more dots also if needed)

So, i.e.

"groups.manager": [
  "groups.bouncer",
  "-basicbot.banall"
  "basicbot.*"
]

"groups.bouncer": [
  "groups.normal",
  "playlist.add",
  "playlist.grab",
  "playlist.activate",
  "basicbot.add",
]

"groups.residentdj": [
  "groups.normal",
  "basicbot.add.self"
]

"groups.normal": [
  "wolfram.search",
  "afk.afk",
]

Users will automatically have the node for their current group, it will also be possible to specify additional nodes for specific users such as:

"users.ylt": [
  "*"
]

These can then be checked via either a function, or via an annotation.

@Command("ban", {permission: "basicbot.ban"})
ban(messageData) {
    //will only reach here if user has the permission :)
}