LuckPerms

LuckPerms

41.4k Downloads

Context groups

KairuByte opened this issue ยท 5 comments

commented

Description

Context groups, similar to permissions groups. As things are, if I wanted to add a large set of contexts onto a set of existing permissions, I can either type them both out individually, or delete them and re-add them with context. If I am simply adding a new permission with those same contexts, I need to type them all out again regardless. Adding or removing a context from existing permissions is also a bit of a pain if there are more than a handful of permissions involved. And auditing permission contexts is just an absolute chore.

Currently, the best workaround I have found is to edit data directly within a connected SQL server. And while this does improve the experience, allowing a direct copy/paste and/or comparison, it does add some technical overhead.

Proposed behaviour

My proposal, I believe, is simple. Context groups.

This would allow the grouping of context values into a single context. Add every context desired to the group, and then simply use that group as the context. This would allow for adding/removing contexts from large sets of permissions from a single point, remove the need to replicate context lists multiple times, and there would be no need to compare lists of contexts during an audit.

commented

I personally find this very useful for network servers where permissions vary a lot based on the different gamemodes.
I have a bit of a different idea though , see this picture:
image
Why not make a global tab and a context tab where you can add more tabs using a plus-button.
This way, users can see which permissions apply in contexts on one page and also, when removing a gamemode, you don't need to go through all your perms to make sure what you dont need anymore is gone, but instead just yeet the tab for the context-perms.
Personally I would probably make one tab for each server and we currently have 8. Seeing the permissions sorted by context defined per tab cleanly would be so amazing.
Sure lp helps you a lot with editing permissions with bulk-edit and search functions etc, however it is still not too easy to handle permissions in context, especially when a permission uses context for multiple servers. With the context-tabs I could easily just get rid of tabs for gamemode-based permissions without fearing my main permissions in the global tab to get lost.
Hope that makes sense.

Edit since I forgot to mention this:
I have an event server, where I offer different minigames. They exchange every 20-30-ish days, meaning i always have to add permissions based on the setup. I'm sure that I'm not the only person having 'temporary servers' that rotate. We always look for something new/different so it's not like I can just reuse the same perms for every setup. Having that said, a tab added to the default group for 'event-server context' would help me out soooo much. Just wipe the tab instead of going through all of it and filter etc. The user friendliness with this would be insane imo. The editor could even auto-add tabs if you place permissions into the global tab but add a context. The only difficulty I see here is with nodes that have more than one context, perhaps those with a matching set could go to one tab and other perms with single context or other matching ones to another tab. Just an idea. I am an organizing-nazi. Pardon my dust :3

commented

+1

commented

Context groups seem like a potentially useful idea - context tabs on the other hand would require a lot of web-dev and even more work internally to synchronize. Seems to me that context groups are also totally different to context-tabs in that a context group is a named object which contains a list of other context names and values. If this were to be implemented and then added to the web-editor, it would likely work best as a an extra section, along with Users and Groups. So as an idea for design and implementation, I see the usage working best this way:

  1. User creates context group - in-game, lp createcontextgroup example and on the web editor just a click of a +
  2. User adds as many contexts as they'd like to the context group - it holds simply name:value contexts in a big list. In-game, lp contextgroup add server:bungee, in the editor just name and value fields.
  3. On any group or permission, user can add a single context: context-group:example which then redirects the context checker to check each context in example on the permission holder.

Not sure if this is feasible to implement for the amount of work it would take to make a system like this, but I can see it being useful not only for people who are in the same position of Kairu, but also for anyone that adds a lot of contexts to things like groups and wants to be able to organize them in a sane way. To be honest, it's not currently the easiest to keep track of a hell of a lot of contexts!

commented

We've sure had a lot of internal discussion about this, and the verdict is that this is generally much too niche a feature to include in the plugin.
First, it only seems to make sense in one very specific and extreme example where contexts need to be changed for a whole load of groups very often - anyone else, which is most people, would have no use for it.

Second and most importantly, it's mostly achievable through clever group structuring that would only require contexts to be changed one time. Here's an example we went through:

# larry and emily are wild minigamerz
/lp user Larry parent add wildminigamer
/lp user Emily parent add wildminigamer

# this week, wildminigamers get a special perk in spleef only if they're flying and delirious
/lp group wildminigamer parent add spleefperks server=spleef flying=true state=delirious

# all the perks they get:
/lp group spleefperks permission set essentials.ban true

By putting permissions into groups and adding those groups as parents of other groups, you can achieve a very simple transition state where you need to change only the contexts on one parent group, and the rest inherit.

Third, we can't think of any more examples where a setup would absolutely require context groups to be usable. No matter how hard we've tried, there's always a way to do it using groups (as groups were intentionally designed to be able to handle this stuff). If you or someone you know has been diagnosed with mesotheli- oh, no. If you or someone you know has a setup idea or system that requires context groups (and isn't simply for aesthetic organization), please do comment on this issue and let us know. Otherwise, this suggestion is unfortunately out of scope for LuckPerms.

commented

Interesting idea - but I can't think of many occasions where you'd need to use such a large intersection of contexts where a group would be useful / needed? Perhaps you could give an example?