PluginManager: fixed plugins being able to alter groups of other plugins' permissions

this could happen if a plugin declared a permission already declared by another plugin, and then declared a different default for it (e.g. true instead of op).
This commit is contained in:
Dylan K. Taylor 2021-11-06 16:32:19 +00:00
parent f81c55ce6c
commit 4cb6c7dc1e
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -172,7 +172,9 @@ class PluginManager{
$everyoneRoot = $permManager->getPermission(DefaultPermissions::ROOT_USER);
foreach($description->getPermissions() as $default => $perms){
foreach($perms as $perm){
$permManager->addPermission($perm);
if(!$permManager->addPermission($perm)){
continue; //TODO: this should be reported as an error and prevent the plugin from loading
}
switch($default){
case PermissionParser::DEFAULT_TRUE:
$everyoneRoot->addChild($perm->getName(), true);