#1034 Create permissions for debug sections
- Add an individual permission for each debug section (including wildcard perm) - Create test for DebugCommand - Refactor tests for the enum permission nodes to use the same abstract class - Update related project files (plugin.yml, permission docs, command docs)
This commit is contained in:
@@ -25,7 +25,7 @@ public class PermissionNodesGatherer {
|
||||
* the second group should contain the enum value.
|
||||
*/
|
||||
private static final Pattern JAVADOC_WITH_ENUM_PATTERN = Pattern.compile(
|
||||
"/\\*\\*\\s+\\*" // Match starting '/**' and the '*' on the next line
|
||||
"/\\*\\*(\\s+\\*)?" // Match starting '/**' and optional whitespace with a '*'
|
||||
+ "(.*?)\\s+\\*/" // Capture everything until we encounter '*/'
|
||||
+ "\\s+([A-Z_]+)\\("); // Match the enum name (e.g. 'LOGIN'), until before the first '('
|
||||
|
||||
@@ -87,8 +87,8 @@ public class PermissionNodesGatherer {
|
||||
Map<String, String> allMatches = new HashMap<>();
|
||||
Matcher matcher = JAVADOC_WITH_ENUM_PATTERN.matcher(source);
|
||||
while (matcher.find()) {
|
||||
String description = matcher.group(1);
|
||||
String enumValue = matcher.group(2);
|
||||
String description = matcher.group(2);
|
||||
String enumValue = matcher.group(3);
|
||||
allMatches.put(enumValue, description);
|
||||
}
|
||||
return allMatches;
|
||||
|
||||
@@ -32,8 +32,9 @@ public class GeneratePluginYml implements AutoToolTask {
|
||||
|
||||
private static final Map<String, String> WILDCARD_PERMISSIONS = ImmutableMap.of(
|
||||
"authme.player.*", "Gives access to all player commands",
|
||||
"authme.player.email", "Gives access to all email commands",
|
||||
"authme.admin.*", "Gives access to all admin commands",
|
||||
"authme.player.email", "Gives access to all email commands");
|
||||
"authme.debug", "Gives access to /authme debug and all its sections");
|
||||
|
||||
private List<PermissionNode> permissionNodes;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user