misuzu/src/Apps/AppScopesInfo.php

23 lines
525 B
PHP

<?php
namespace Misuzu\Apps;
class AppScopesInfo {
/**
* @param string[] $allowed
* @param string[] $denied
*/
public function __construct(
public private(set) array $allowed,
public private(set) array $denied
) {}
public function isAllowed(string $scope, bool $requiresAllow): bool {
if(in_array($scope, $this->denied))
return false;
if($requiresAllow && !in_array($scope, $this->allowed))
return false;
return true;
}
}