package com.ssyf.config;


import cn.dev33.satoken.stp.StpInterface;
import com.ssyf.module.auth.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 
 * @author huwei 
 * @date 2024/3/29 13:51
 */
@Component
public class StpInterfaceImpl implements StpInterface {

    @Autowired
    private UserService userService;

    /**
     * 返回当前用户权限
     * @author huwei
     * @date 2024/3/29 13:52
     */
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return this.userService.getPermissionByUserUid(loginId.toString());
    }

    /**
     * 返回一个账号所拥有的角色标识集合 (权限与角色可分开校验)
     */
    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return this.userService.getRoleByUserUid(loginId.toString());
    }

}