Updated permissions in plugin.yml and nukkit.yml

This commit is contained in:
Risto Lahtela 2020-08-31 19:05:37 +03:00
parent d12297494c
commit a47ce3e57e
6 changed files with 106 additions and 131 deletions

View File

@ -191,7 +191,7 @@ public class RegistrationCommands {
}
User presentUser = found.get();
boolean ownsTheUser = Objects.equals(playerUUID, presentUser.getLinkedToUUID());
if (!(ownsTheUser || sender.hasPermission(Permissions.MANAGE_WEB.getPerm()))) {
if (!(ownsTheUser || sender.hasPermission(Permissions.UNREGISTER_OTHER.getPerm()))) {
throw new IllegalArgumentException(locale.getString(CommandLang.USER_NOT_LINKED));
}

View File

@ -53,18 +53,6 @@ public enum Permissions {
JSON_SELF("plan.json.self"),
JSON_OTHER("plan.json.other"),
HELP("plan.?"),
INSPECT("plan.inspect.base"),
QUICK_INSPECT("plan.qinspect.base"),
INSPECT_OTHER("plan.inspect.other"),
QUICK_INSPECT_OTHER("plan.qinspect.other"),
ANALYZE("plan.analyze"),
MANAGE("plan.manage"),
MANAGE_WEB("plan.webmanage"),
IGNORE_COMMAND_USE("plan.ignore.commanduse"),
IGNORE_AFK("plan.ignore.afk");

View File

@ -44,7 +44,7 @@ public class MiscUtils {
* @return Player name.
*/
public static String getPlayerName(String[] args, Sender sender) {
return getPlayerName(args, sender, Permissions.INSPECT_OTHER);
return getPlayerName(args, sender, Permissions.PLAYER_OTHER);
}
/**

View File

@ -11,69 +11,63 @@ commands:
description: base command
permissions:
plan.?:
description: Help command
plan.server:
default: op
plan.servers:
default: op
plan.network:
default: op
plan.player.self:
default: true
plan.inspect.base:
description: Allows you to check your player data.
default: true
plan.inspect.other:
description: Allows you to check other players' player data.
default: op
plan.qinspect.base:
description: Allows you to check your player data.
default: op
plan.qinspect.other:
description: Allows you to check other players' player data.
plan.analyze:
description: Allows you to check analysed data about all players.
default: op
plan.qanalyze:
description: Allows you to check analysed data about all players.
default: op
plan.reload:
description: Allows to reload plugin config
plan.player.other:
default: op
plan.search:
description: Allows search
default: op
plan.ingame.self:
default: true
plan.ingame.other:
default: op
plan.register.self:
default: true
plan.register.other:
default: op
plan.unregister.self:
default: true
plan.unregister.other:
default: op
plan.info:
description: Allows to view info
default: op
plan.reload:
default: op
plan.disable:
default: op
plan.users:
default: op
plan.data.base:
default: op
plan.data.backup:
default: op
plan.data.restore:
default: op
plan.data.move:
default: op
plan.data.hotswap:
default: op
plan.data.clear:
default: op
plan.data.remove.player:
default: op
plan.data.remove.server:
default: op
plan.data.export:
default: op
plan.data.import:
default: op
plan.json.self:
default: true
plan.json.other:
default: op
plan.ignore.commanduse:
description: Commands used by this player are not saved
default: false
plan.ignore.afk:
description: AFK time by this player is ignored
default: false
plan.manage:
description: Manage the database, clear, move, combine.
default: op
plan.webmanage:
description: Manage the webusers, delete, list, check
default: op
plan.basic:
children:
plan.?: true
plan.inspect.base: true
plan.qinspect.base: true
plan.advanced:
childer:
plan.basic: true
plan.info: true
plan.qanalyze: true
plan.staff:
children:
plan.search: true
plan.advanced: true
plan.analyze: true
plan.inspect.other: true
plan.qinspect.other: true
plan.webmanage: true
plan.reload: true
plan.*:
children:
plan.manage: true
plan.staff: true
apf.notify: true
default: false

View File

@ -33,73 +33,66 @@ softdepend:
commands:
plan:
usage: /plan help
description: base command
usage: /plan
permissions:
plan.?:
description: Help command
plan.server:
default: op
plan.servers:
default: op
plan.network:
default: op
plan.player.self:
default: true
plan.inspect.base:
description: Allows you to check your player data.
default: true
plan.inspect.other:
description: Allows you to check other players' player data.
default: op
plan.qinspect.base:
description: Allows you to check your player data.
default: op
plan.qinspect.other:
description: Allows you to check other players' player data.
plan.analyze:
description: Allows you to check analysed data about all players.
default: op
plan.qanalyze:
description: Allows you to check analysed data about all players.
default: op
plan.reload:
description: Allows to reload plugin config
plan.player.other:
default: op
plan.search:
description: Allows search
default: op
plan.ingame.self:
default: true
plan.ingame.other:
default: op
plan.register.self:
default: true
plan.register.other:
default: op
plan.unregister.self:
default: true
plan.unregister.other:
default: op
plan.info:
description: Allows to view info
default: op
plan.reload:
default: op
plan.disable:
default: op
plan.users:
default: op
plan.data.base:
default: op
plan.data.backup:
default: op
plan.data.restore:
default: op
plan.data.move:
default: op
plan.data.hotswap:
default: op
plan.data.clear:
default: op
plan.data.remove.player:
default: op
plan.data.remove.server:
default: op
plan.data.export:
default: op
plan.data.import:
default: op
plan.json.self:
default: true
plan.json.other:
default: op
plan.ignore.commanduse:
description: Commands used by this player are not saved
default: false
plan.ignore.afk:
description: AFK time by this player is ignored
default: false
plan.manage:
description: Manage the database, clear, move, combine.
default: op
plan.webmanage:
description: Manage the webusers, delete, list, check
default: op
plan.basic:
children:
plan.?: true
plan.inspect.base: true
plan.qinspect.base: true
plan.advanced:
childer:
plan.basic: true
plan.info: true
plan.qanalyze: true
plan.staff:
children:
plan.search: true
plan.advanced: true
plan.analyze: true
plan.inspect.other: true
plan.qinspect.other: true
plan.webmanage: true
plan.reload: true
plan.*:
children:
plan.manage: true
plan.staff: true
apf.notify: true
default: false

View File

@ -35,7 +35,7 @@ class MiscUtilsTest {
private Sender mockAPlayerSender(String name, boolean hasPermission) {
Sender sender = Mockito.mock(Sender.class);
when(sender.hasPermission(Permissions.INSPECT_OTHER.getPermission())).thenReturn(hasPermission);
when(sender.hasPermission(Permissions.PLAYER_OTHER.getPermission())).thenReturn(hasPermission);
when(sender.getName()).thenReturn(name);
when(sender.getSenderType()).thenReturn(SenderType.PLAYER);
return sender;