You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
997 B
40 lines
997 B
package com.jiagutech.ams.config;
|
|
|
|
import cn.dev33.satoken.stp.StpInterface;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import com.jiagutech.ams.constant.UserConstants;
|
|
import com.jiagutech.ams.model.LoginUser;
|
|
import com.jiagutech.ams.utils.LoginUtil;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* sa-token 权限管理实现类
|
|
*
|
|
* @author Lion Li
|
|
*/
|
|
public class SaPermissionImpl implements StpInterface {
|
|
|
|
/**
|
|
* 获取菜单权限列表
|
|
*/
|
|
@Override
|
|
public List<String> getPermissionList(Object loginId, String loginType) {
|
|
|
|
return new ArrayList<>();
|
|
}
|
|
|
|
/**
|
|
* 获取角色权限列表
|
|
*/
|
|
@Override
|
|
public List<String> getRoleList(Object loginId, String loginType) {
|
|
LoginUser loginUser = LoginUtil.getLoginUser();
|
|
if (loginUser == null || loginUser.getRoles() == null) {
|
|
return new ArrayList<>();
|
|
}
|
|
return loginUser.getRoles().stream().map(role -> role.getKey()).toList();
|
|
}
|
|
}
|
|
|