Skip to content

Commit

Permalink
Updated permissions in plugin.yml and nukkit.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraLS3 committed Oct 6, 2020
1 parent d122974 commit a47ce3e
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void onUnregister(String mainCommand, CMDSender sender, Arguments argumen
}
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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private 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);
}

/**
Expand Down
100 changes: 47 additions & 53 deletions Plan/common/src/main/resources/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
plan.player.other:
default: op
plan.search:
default: op
plan.ingame.self:
default: true
plan.inspect.other:
description: Allows you to check other players' player data.
plan.ingame.other:
default: op
plan.qinspect.base:
description: Allows you to check your player data.
plan.register.self:
default: true
plan.register.other:
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.
plan.unregister.self:
default: true
plan.unregister.other:
default: op
plan.qanalyze:
description: Allows you to check analysed data about all players.
plan.info:
default: op
plan.reload:
description: Allows to reload plugin config
default: op
plan.search:
description: Allows search
plan.disable:
default: op
plan.info:
description: Allows to view info
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
103 changes: 48 additions & 55 deletions Plan/common/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
plan.player.other:
default: op
plan.search:
default: op
plan.ingame.self:
default: true
plan.inspect.other:
description: Allows you to check other players' player data.
plan.ingame.other:
default: op
plan.qinspect.base:
description: Allows you to check your player data.
plan.register.self:
default: true
plan.register.other:
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.
plan.unregister.self:
default: true
plan.unregister.other:
default: op
plan.qanalyze:
description: Allows you to check analysed data about all players.
plan.info:
default: op
plan.reload:
description: Allows to reload plugin config
default: op
plan.search:
description: Allows search
plan.disable:
default: op
plan.info:
description: Allows to view info
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a47ce3e

Please sign in to comment.