mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Removal of permission defaults (in favour of permission cascading) (#3937)
This commit is contained in:
@@ -31,14 +31,6 @@ namespace pocketmine\permission;
|
||||
* Represents a permission
|
||||
*/
|
||||
class Permission{
|
||||
public const DEFAULT_OP = "op";
|
||||
public const DEFAULT_NOT_OP = "notop";
|
||||
public const DEFAULT_TRUE = "true";
|
||||
public const DEFAULT_FALSE = "false";
|
||||
|
||||
/** @var string */
|
||||
public static $DEFAULT_PERMISSION = self::DEFAULT_OP;
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
@@ -51,19 +43,15 @@ class Permission{
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/** @var string */
|
||||
private $defaultValue;
|
||||
|
||||
/**
|
||||
* Creates a new Permission object to be attached to Permissible objects
|
||||
*
|
||||
* @param bool[] $children
|
||||
* @phpstan-param array<string, bool> $children
|
||||
*/
|
||||
public function __construct(string $name, ?string $description = null, ?string $defaultValue = null, array $children = []){
|
||||
public function __construct(string $name, ?string $description = null, array $children = []){
|
||||
$this->name = $name;
|
||||
$this->description = $description ?? "";
|
||||
$this->defaultValue = $defaultValue ?? self::$DEFAULT_PERMISSION;
|
||||
$this->children = $children;
|
||||
|
||||
$this->recalculatePermissibles();
|
||||
@@ -81,17 +69,6 @@ class Permission{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
public function getDefault() : string{
|
||||
return $this->defaultValue;
|
||||
}
|
||||
|
||||
public function setDefault(string $value) : void{
|
||||
if($value !== $this->defaultValue){
|
||||
$this->defaultValue = $value;
|
||||
$this->recalculatePermissibles();
|
||||
}
|
||||
}
|
||||
|
||||
public function getDescription() : string{
|
||||
return $this->description;
|
||||
}
|
||||
@@ -110,8 +87,6 @@ class Permission{
|
||||
public function recalculatePermissibles() : void{
|
||||
$perms = $this->getPermissibles();
|
||||
|
||||
PermissionManager::getInstance()->recalculatePermissionDefaults($this);
|
||||
|
||||
foreach($perms as $p){
|
||||
$p->recalculatePermissions();
|
||||
}
|
||||
|
Reference in New Issue
Block a user