<?php
namespace app\common;



use app\model\SysUser;
use Tinywan\Jwt\JwtToken;

class Auth
{
    /**
     * 获取权限范围内的所有管理员id
     * @param bool $with_self
     * @return array
     */
    public static function getScopeAdminIds(bool $withSelf = false): array
    {
        $userIds = SysUser::where('user_id','!=',0)->pluck('user_id')->toArray();
        if ($withSelf) {
            $userIds[] = JwtToken::getCurrentId();
        }
        return array_unique($userIds);
    }

    /**
     * 是否是超级管理员
     * @param int $admin_id
     * @return bool
     */
    public static function isSupperAdmin(int $admin_id = 0): bool
    {
        // 暂时不涉及权限
        return true;
    }

}