Requested changes for web editor data
Closed this issue ยท 7 comments
For the rewrite of the web editor that I'm doing, I need a few things from the plugin side to make some features work.
- Need the ability to create new groups - currently the
applyedits
command will only parse groups that exist in the database, if I add groups and try to apply the changes they just get skipped - Track data would be useful, a list of tracks and which groups they contain, and a way to update changes to tracks (e.g. new tracks, renamed, re-ordered groups, etc.)
- LP version info, so I can inform a user that some features may not work if they are using an old version of LuckPerms (and strongly suggest that they update!)
- A way to add a
expired
or similar property to an editor session's data stored on Bytebin so we can inform a user that their editor session may not be up to date if they try to access it again after applying changes - Allow users to rename and delete groups, as per Turbotailz/LuckPermsWeb#18
- Is it possible to get a list of known servers/worlds? Would make selecting contexts a lot easier for users.
That's all I can think of at the moment, I will update this issue with more things later if I think of them.
I've started work on some of this.
The format, ("schema" whatever you want to call it) of the JSON payloads sent between the plugin/editor have been changed a bit to reflect the wider changes in v5 of the plugin.
Outgoing request:
{
"metadata": {
"commandAlias": "/lp",
"uploader": {
"name": "Luck",
"uuid": "--uuid here--"
},
"time": 12345,
"pluginVersion": "v5.0.0"
},
"permissionHolders": [
{
"type": "group",
"id": "admin",
"displayName": "Admin",
"nodes": [
{
"type": "permission",
"key": "essentials.fly",
"value": true,
"expiry": 123,
"context": {
"server": "factions"
}
}
]
},
{
"type": "user",
"id": "-- uuid here--",
"displayName": "Luck",
"nodes": [
{
"type": "permission",
"key": "essentials.fly",
"value": true,
"expiry": 123,
"context": {
"server": "factions"
}
}
]
}
],
"tracks": [
{
"type": "track",
"id": "staff",
"groups": ["helper", "mod", "admin"]
}
],
"knownPermissions": ["essentials", "essentials.ban", "essentials.unban"]
}
Expected format of incoming request:
{
"changes": [
{
"type": "group",
"id": "admin",
"nodes": [] // in same format as outgoing
},
{
"type": "track",
"id": "staff",
"groups": [] // in same format as outgoing
}
],
"groupDeletions": [
"moderator"
],
"trackDeletions": [
"donors"
]
}
Is that going to support group renaming? How do you know if a group has been renamed and not a new group?
To rename, just specify the new name of the group in the changes
section, and include the old name in groupDeletions
.
Oh one other thing, all times for expiry
etc are unix timestamps in seconds.
If that attribute isn't included, it's assumed the node doesn't expire.
The possible nodes
type
s are listed here.
Just lowercase'd.
Is it possible to get a list of known servers/worlds? Would make selecting contexts a lot easier for users.
Adding on to this, is it possible to also get a list of known context keys?