RESTfulAPI::model_permission_check PHP Метод

model_permission_check() приватный статический Метод

For permissions to actually be checked, this means the RESTfulAPI must have both authenticator and authority dependencies defined. If the authenticator component does not return an instance of the Member null will be passed to the authority component. This default to true.
private static model_permission_check ( string | DataObject $model, string $httpMethod = 'GET' ) : boolean
$model string | DataObject Model's classname or DataObject to check permission for
$httpMethod string API request HTTP method
Результат boolean true if access is granted, false otherwise
    private static function model_permission_check($model, $httpMethod = 'GET')
    {
        $access = true;
        $apiInstance = self::$instance;
        if ($apiInstance->authenticator && $apiInstance->authority) {
            $request = $apiInstance->request;
            $member = $apiInstance->authenticator->getOwner($request);
            if (!$member instanceof Member) {
                $member = null;
            }
            $access = $apiInstance->authority->checkPermission($model, $member, $httpMethod);
            if (!is_bool($access)) {
                $access = true;
            }
        }
        return $access;
    }