-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Target permissions #575
Target permissions #575
Conversation
My suggestion is to use String permissionTargeted() default "@"; |
How about a new subpermission? |
It's basically just another syntax of what you have here, looking for peoples opinions |
Account.hasPermission() should also be updated. |
Good catch, I didn't see that it already has wildcards |
I don't consider subpermission to be a good idea, because "player.*" seems to cover all the subpermissions under the player permission, but in fact we don't want those with player permission to have @ permission |
This could be a solution |
The permission system will be getting a rewrite soon to make it more expandable and to fix this sort of thing. Current plan is for * to be a first layer wildcard and ** to be an all layer wildcard |
Added this
EDIT: Hacky unit test over at https://github.com/Birdulon/Grasscutter/tree/TargetPermsUnitTest |
Note that
Implementation of wildcard can be done as regular expression, so internally it becomes:
Internally, we would store list of permissions account has, then escape expression and replace |
Change target perm from target.perm to x.perm.others
Fixed merge conflicts. |
Adds permissionTargeted to all applicable commands. (i.e. every command which targets a player and isn't sendmail)
The
player.perm
andserver.perm
distinction seems a bit ill-defined, things likedrop
seem like they should beplayer.drop
instead ofserver.drop
(ideally I think the trueserver.perm
commands wouldn't have atarget.perm
permission at all since they would imply usage on anyone and everyone), but that might be something to leave for one big permissions rework down the track since any changes would involve db migration procedures for server operators. I think some wildcard matching would be good at some point, so admins can set things likeplayer.*
and*.spawn
for convenience.