Add a wildcard command permission

This commit is contained in:
Xephi 2015-12-05 19:00:44 +01:00
parent a8b3fe2648
commit 1db24adb5d
3 changed files with 22 additions and 12 deletions

View File

@ -90,7 +90,7 @@ public final class CommandInitializer {
.detailedDescription("Register the specified player with the specified password.") .detailedDescription("Register the specified player with the specified password.")
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.withArgument("password", "Password", false) .withArgument("password", "Password", false)
.permissions(OP_ONLY, AdminPermission.REGISTER) .permissions(OP_ONLY, AdminPermission.REGISTER, AdminPermission.ALL)
.executableCommand(new RegisterAdminCommand()) .executableCommand(new RegisterAdminCommand())
.build(); .build();
@ -101,7 +101,7 @@ public final class CommandInitializer {
.description("Unregister a player") .description("Unregister a player")
.detailedDescription("Unregister the specified player.") .detailedDescription("Unregister the specified player.")
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.permissions(OP_ONLY, AdminPermission.UNREGISTER) .permissions(OP_ONLY, AdminPermission.UNREGISTER, AdminPermission.ALL)
.executableCommand(new UnregisterAdminCommand()) .executableCommand(new UnregisterAdminCommand())
.build(); .build();
@ -112,7 +112,7 @@ public final class CommandInitializer {
.description("Enforce login player") .description("Enforce login player")
.detailedDescription("Enforce the specified player to login.") .detailedDescription("Enforce the specified player to login.")
.withArgument("player", "Online player name", true) .withArgument("player", "Online player name", true)
.permissions(OP_ONLY, PlayerPermission.CAN_LOGIN_BE_FORCED) .permissions(OP_ONLY, PlayerPermission.CAN_LOGIN_BE_FORCED, AdminPermission.ALL)
.executableCommand(new ForceLoginCommand()) .executableCommand(new ForceLoginCommand())
.build(); .build();
@ -124,7 +124,7 @@ public final class CommandInitializer {
.detailedDescription("Change the password of a player.") .detailedDescription("Change the password of a player.")
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.withArgument("pwd", "New password", false) .withArgument("pwd", "New password", false)
.permissions(OP_ONLY, AdminPermission.CHANGE_PASSWORD) .permissions(OP_ONLY, AdminPermission.CHANGE_PASSWORD, AdminPermission.ALL)
.executableCommand(new ChangePasswordAdminCommand()) .executableCommand(new ChangePasswordAdminCommand())
.build(); .build();
@ -135,7 +135,7 @@ public final class CommandInitializer {
.description("Player's last login") .description("Player's last login")
.detailedDescription("View the date of the specified players last login.") .detailedDescription("View the date of the specified players last login.")
.withArgument("player", "Player name", true) .withArgument("player", "Player name", true)
.permissions(OP_ONLY, AdminPermission.LAST_LOGIN) .permissions(OP_ONLY, AdminPermission.LAST_LOGIN, AdminPermission.ALL)
.executableCommand(new LastLoginCommand()) .executableCommand(new LastLoginCommand())
.build(); .build();
@ -146,7 +146,7 @@ public final class CommandInitializer {
.description("Display player accounts") .description("Display player accounts")
.detailedDescription("Display all accounts of a player by his player name or IP.") .detailedDescription("Display all accounts of a player by his player name or IP.")
.withArgument("player", "Player name or IP", true) .withArgument("player", "Player name or IP", true)
.permissions(OP_ONLY, AdminPermission.ACCOUNTS) .permissions(OP_ONLY, AdminPermission.ACCOUNTS, AdminPermission.ALL)
.executableCommand(new AccountsCommand()) .executableCommand(new AccountsCommand())
.build(); .build();
@ -156,7 +156,7 @@ public final class CommandInitializer {
.labels("getemail", "getmail", "email", "mail") .labels("getemail", "getmail", "email", "mail")
.description("Display player's email") .description("Display player's email")
.detailedDescription("Display the email address of the specified player if set.") .detailedDescription("Display the email address of the specified player if set.")
.permissions(OP_ONLY, AdminPermission.GET_EMAIL) .permissions(OP_ONLY, AdminPermission.GET_EMAIL, AdminPermission.ALL)
.withArgument("player", "Player name", true) .withArgument("player", "Player name", true)
.executableCommand(new GetEmailCommand()) .executableCommand(new GetEmailCommand())
.build(); .build();
@ -168,7 +168,7 @@ public final class CommandInitializer {
.labels("chgemail", "chgmail", "setemail", "setmail") .labels("chgemail", "chgmail", "setemail", "setmail")
.description("Change player's email") .description("Change player's email")
.detailedDescription("Change the email address of the specified player.") .detailedDescription("Change the email address of the specified player.")
.permissions(OP_ONLY, AdminPermission.CHANGE_EMAIL) .permissions(OP_ONLY, AdminPermission.CHANGE_EMAIL, AdminPermission.ALL)
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.withArgument("email", "Player email", false) .withArgument("email", "Player email", false)
.build(); .build();
@ -304,7 +304,7 @@ public final class CommandInitializer {
.description("Login command") .description("Login command")
.detailedDescription("Command to log in using AuthMeReloaded.") .detailedDescription("Command to log in using AuthMeReloaded.")
.parent(null) .parent(null)
.permissions(ALLOWED, PlayerPermission.LOGIN) .permissions(ALLOWED, PlayerPermission.LOGIN, PlayerPermission.ALL_COMMANDS)
.withArgument("password", "Login password", false) .withArgument("password", "Login password", false)
.build(); .build();
@ -334,7 +334,7 @@ public final class CommandInitializer {
.detailedDescription("Command to register using AuthMeReloaded.") .detailedDescription("Command to register using AuthMeReloaded.")
.withArgument("password", "Password", false) .withArgument("password", "Password", false)
.withArgument("verifyPassword", "Verify password", false) .withArgument("verifyPassword", "Verify password", false)
.permissions(ALLOWED, PlayerPermission.REGISTER) .permissions(ALLOWED, PlayerPermission.REGISTER, PlayerPermission.ALL_COMMANDS)
.executableCommand(new RegisterCommand()) .executableCommand(new RegisterCommand())
.build(); .build();

View File

@ -98,7 +98,12 @@ public enum AdminPermission implements PermissionNode {
/** /**
* Administrator command to reload the plugin configuration. * Administrator command to reload the plugin configuration.
*/ */
RELOAD("authme.command.admin.reload"); RELOAD("authme.command.admin.reload"),
/**
* Give access to all admin commands
*/
ALL("authme.command.admin.*");
/** /**
* Permission node. * Permission node.

View File

@ -78,7 +78,12 @@ public enum PlayerPermission implements PermissionNode {
/** /**
* Permission for user to see other accounts. * Permission for user to see other accounts.
*/ */
SEE_OTHER_ACCOUNTS("authme.command.player.seeotheraccounts"); SEE_OTHER_ACCOUNTS("authme.command.player.seeotheraccounts"),
/**
*
*/
ALL_COMMANDS("authme.command.player.*");
/** /**
* Permission node. * Permission node.