package com.cyksj.web.controller.manage.cms.interceptor;

import cn.dev33.satoken.stp.StpInterface;
import com.cyksj.service.mange.cms.CmsUserManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/*
 *项目名: yicang-admin
 *文件名: Inter
 *创建者: JavaZou
 *创建时间:2022/9/30 10:34
 */
@Component
public class StpInterfaceImpl implements StpInterface {
	@Autowired
	private CmsUserManager cmsUserManager;

	/**
	 * 用户权限列表
	 */
	@Override
	public List<String> getPermissionList(Object loginId, String loginType) {
		return new ArrayList<>(cmsUserManager.getUserPermissions(Long.valueOf(loginId.toString())));
	}

	@Override
	public List<String> getRoleList(Object loginId, String loginType) {
		return new ArrayList<>(cmsUserManager.getUserRoles(Long.valueOf(loginId.toString())));
	}
}
