1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 20:00:27 +08:00
2020-09-23 21:41:21 +08:00

27 lines
554 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($authInfo)
{
if (empty($authInfo['id'])) {
throw new UnauthorizedException('sys.unauthorized');
}
}
public function checkOwner($userId, $ownerId)
{
if ($userId != $ownerId) {
throw new ForbiddenException('sys.forbidden');
}
}
}