LuckPerms

LuckPerms

41.4k Downloads

Primary group does not set back to another parent group when the group is removed.

mibby opened this issue ยท 9 comments

commented

LuckPerms dev 358

/lp user <user> switchprimarygroup admin
/lp user <user> switchprimarygroup donor
/lp user <user> info

Will show the user's primary group as donor with a parent group of admin and donor.

/lp user <user> parent remove donor
/lp user <user> info
Will still show the user's primary group as donor while parent group only displays as admin. This also makes it so the player shows up in /list as donor instead of admin even though they don't have the rank.

Would it be possible to use the user's last group as the new primary if they no longer have permission for that parent group? i.e. only displaying groups / primary prefix for ranks they actually have.


With PEX,

/pex user <user> group set admin

  uuid-string-blablabla:
    group:
    - admin
    options:
      name: player

Player talks, has admin prefix.

/pex user <user> group add donor

Add command always sets the last group on top as primary.

  uuid-string-blablabla:
    group:
    - donor
    - admin
    options:
      name: player

Player talks, has donor prefix.

/pex user <user> group remove donor

  uuid-string-blablabla:
    group:
    - admin
    options:
      name: player

Player talks, has admin prefix again.

commented

You can use /lp user <user> parent set <group> to remove all parents of the user and set the group...
This is the same like the set-command of PEX.

commented

While /lp user <user> parent set <group> is similar to PEX's set command, this is not ideal for players who have multiple ranks across different tracks. Such as if a player has a builder rank and a donor rank. When adding a rank to a player from a separate track or from the current track but higher up, it does not set the primary group automatically like PEX did when adding groups.

This issue however is regarding primary groups not being removed when you remove a group. It still shows and uses the primary group last set even if that rank isn't part of that player's groupings. Thus they could be a staff member who shows up as a donor in /list and have the donor prefix when they shouldn't.

commented

While /lp user parent set is similar to PEX's set command, this is not ideal for players who have multiple ranks across different tracks. Such as if a player has a builder rank and a donor rank. When adding a rank to a player from a separate track or from the current track but higher up, it does not set the primary group automatically like PEX did when adding groups.

If you want to set their primary group, without affecting other inheritances, use switchprimarygroup. If you want to remove other inheritances, use parent set.

This issue however is regarding primary groups not being removed when you remove a group. It still shows and uses the primary group last set even if that rank isn't part of that player's groupings. Thus they could be a staff member who shows up as a donor in /list and have the donor prefix when they shouldn't.

Should be fixed by the above commit.

commented

That's unfortunate because setting users to default when removing a group is terrible when you use the default as a guest rank.

For example, say a person has a member rank. They then want to purchase a subscription that expires in 30 days.

lp user {uuid} switchprimarygroup subscription

The user now has the subscription rank and has it shown as their primary group. After 30 days, it runs an expiration command.

lp user {uuid} parent remove subscription

This removes the subscription rank from the player but now all of a sudden they are a member that has a guest tag, because their primary group was set to default.

At the very least, when removing a group, it should scan the user permissions and use another group they have access to rather than force default. Because not every person would have the same primary group when removing another group.

This seems like an inherent flaw in LuckPerms. In my opinion, PEX's way of managing primary group for prefix automatically is much better since there can't be a case of users having prefixes for ranks they don't have or forcing them to use default when they don't even have / inherit default.

commented

Should be fixed by the above commit.

Is there no way to have it set the player's primary group back to their last group set or to another group they have permission for when removing the group that is their primary-group? New behavior seems to always set it as default, which is used for guest prefix and listing. Whereas with PEX, if you removed a player's group, it still used their top-most group they still have as their primary.

commented

No, because LuckPerms has no sense of a "top-most" group.

commented

This default behavior is also bad when demoting players in a track.

For example if you have a staff track from helper > mod > admin. If a user is grouped mod with their primary set to mod and you demote them via /lp user <user> demote <track>, their primary group gets set to default instead of the lower rank in the track.

commented

No, they'd be set to helper in this case.
Primary groups are modified when using track promote & demote commands.

Ultimately, the whole concept of "primary groups" is a flawed system, because:

  1. Players can be a member of lots of groups. (Unlike in other plugins, LuckPerms allows users & groups to inherit from unlimited other groups in unlimited contexts.)

  2. Players can be a member of some "more important" or higher priority groups but only in a specific context.

  3. Players might indirectly or temporarily inherit from a "more important" or higher priority group - yet that would never apply.

This is why the primary group system is fairly basic. There is only one command exposed to change it, and I encourage that you use the weight based alternatives. (as of 597f2f7 this is the default setting)

there can't be a case of users having prefixes for ranks they don't have

This was a bug - and was fixed after your report.

This seems like an inherent flaw in LuckPerms. In my opinion, PEX's way of managing primary group

PEX's approach is entirely incompatible with SQL, as changing the order of assignments in-game is messy and unintuitive. This was a big issue with PEX users opting to store data in SQL, and perhaps the reason why it was so unpopular to do so.

commented

No, they'd be set to helper in this case.
Primary groups are modified when using track promote & demote commands.

Apologies, the report I received was misinterpreted. You don't lose the primary group unless you are demoted entirely out of the track, even if you had other groups.

I encourage that you use the weight based alternatives.

While I would like to, many of my players still prefer to have one group prefix shown over another. Hence the idea of re-ordering and setting a primary group. If it was set to parent-by-weight, all groups would have a forced prefix over another the higher the weight value. If all groups had equal weight, I assume it would pick the first group in alphabetical order.

This is why I have all groups with an equal weight and require the primary group function / command to force what group players want to use - with staff having a higher weight to always display staff prefix.

This was a bug - and was fixed after your report.

I would consider it partially fixed because no one inherits the 'default' group for me. So forcing default as the primary when demoting someone entirely out of a track or removing a group via /lp user <user> parent remove is setting players as guests rather than to another group they actually have.