Minestom icon indicating copy to clipboard operation
Minestom copied to clipboard

Add permissions wildcard support to no-verifier hasPermission

Open dev-hydrogen opened this issue 3 years ago • 5 comments

Adds wildcard support to hasPermission(Permission permission) and relevant tests

If a player has permission foo.*, foo.bar and foo.bar.baz will return true, but simply foo will not. Technically you could give foo* as a permission, which would make this return true for ”foo”. If a player has the permission *, this method will always return true.

Some fancy word here for saying that this is a working/better version of #719

dev-hydrogen avatar Aug 09 '22 00:08 dev-hydrogen

Some fancy word here for saying that this is a working/better version of https://github.com/Minestom/Minestom/pull/719

successor?

emortaldev avatar Aug 09 '22 08:08 emortaldev

I'd like to see support for proper pattern matching.

e.g. foo.b*r could match queries for foo.bar, or foo.boar foo.bar.*s could match foo.bar.baz.bos f*o.bar could match fooooooo.bar

KrystilizeNevaDies avatar Aug 09 '22 17:08 KrystilizeNevaDies

I'd like to see support for proper pattern matching.

e.g. foo.b*r could match queries for foo.bar, or foo.boar foo.bar.*s could match foo.bar.baz.bos f*o.bar could match fooooooo.bar

I have an idea on how to do this, but my implementation would need to know the separator, which minestom currently doesnt take any stance on. ("odd" permissions like "namespace:foo/bar" are allowed), what should be the list of supported separators?

dev-hydrogen avatar Aug 10 '22 14:08 dev-hydrogen

Uhh, I don't think separators should even be considered personally.

They could be there as a standard, but nothing in code should identify them imo.

KrystilizeNevaDies avatar Aug 10 '22 14:08 KrystilizeNevaDies

Uhh, I don't think separators should even be considered personally.

They could be there as a standard, but nothing in code should identify them imo.

You're right actually, at first i was thinking of replacing any other separators like / with a . in regex, but that doesn't actually make any sense lol

dev-hydrogen avatar Aug 10 '22 15:08 dev-hydrogen

I would like to get this merged, please update to latest master commit.

KrystilizeNevaDies avatar Mar 30 '23 21:03 KrystilizeNevaDies