mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-19 06:36:14 +08:00
27 lines
540 B
PHP
27 lines
540 B
PHP
<?php
|
|
|
|
namespace App\Validators;
|
|
|
|
use App\Exceptions\Forbidden as ForbiddenException;
|
|
use App\Exceptions\Unauthorized as UnauthorizedException;
|
|
use Phalcon\Di\Injectable;
|
|
|
|
class Validator extends Injectable
|
|
{
|
|
|
|
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');
|
|
}
|
|
}
|
|
|
|
}
|