1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-22 03:32:47 +08:00

27 lines
544 B
PHP

<?php
namespace App\Validators;
use App\Exceptions\Forbidden as ForbiddenException;
use App\Exceptions\Unauthorized as UnauthorizedException;
use Phalcon\Mvc\User\Component;
class Validator extends Component
{
public function checkAuthUser($userId)
{
if (empty($userId)) {
throw new UnauthorizedException('sys.unauthorized');
}
}
public function checkOwner($userId, $ownerId)
{
if ($userId != $ownerId) {
throw new ForbiddenException('sys.forbidden');
}
}
}