IntellectualSites / IntellectualSites/PlotSquared

Odd permission checks for the flag-remove command

Open
#3,155 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
653
Forks
975
Avg merge
2m
Merged PRs (30d)
6

Description

Server Implementation

Paper

Server Version

1.17.1

Describe the bug

The command /p flag remove <some flag> gives a no-permission message, while the command /p flag remove <some flag> test removes the flag from your plot. Moreover, even with the permission plots.set.flag.<some flag>.*, you get a no-permission message when using /p flag remove <some flag>.

To Reproduce
  1. Give yourself access to plots.flag.remove and plots.set.flag.lectern-read-book.*, but not to plots.set.flag.lectern-read-book.
  2. Set the lectern-read-book flag to true on your plot.
  3. Run the commands /p flag remove lectern-read-book and /p flag remove lectern-read-book test and observe the difference.
Expected behaviour

Permitted usage of the flag-remove command to not depend on some random second argument. I don't care if players need some permission extra to plots.flag.remove to remove a flag.

However, in case the extra permission requirement plots.set.flag.<some flag> for /plot flag remove <some flag> is kept, I would prefer it if plots.set.flag.<some flag>.* also gives access to /plot flag remove <some flag>. Just so I don't need to go through all flag permissions and grant players plots.set.flag.<some flag> in addition to plots.set.flag.<some flag>.*.

Screenshots / Videos

No response

Error log (if applicable)

No response

Plot Debugpaste

Not necessary, issue is obvious in the code.

PlotSquared Version

Built 635e18e7ed47029992ec59cf32429275d904c49c from source

Checklist
Anything else?

The cause is this code block.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked FlagCommand.java block at lines 462-470 and compare permission handling for /p flag remove <flag> versus the form with a second argument. Reproduce the two commands with the permissions listed in the issue. Done means flag removal no longer depends on an unrelated second argument, and the intended wildcard permission behavior is consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authorization, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.