子角色权限

pull/1121/head
梁宇奇 2025-06-18 20:58:30 +08:00
parent e7c320c474
commit acf88d6533
1 changed files with 45 additions and 0 deletions

View File

@ -68,6 +68,51 @@ public class SecurityUtils {
return false;
}
/**
*
*
* @param storeId
* @return
*/
public static boolean isStoreSub(Long storeId) {
if (storeId == null) {
return false;
}
try {
Authentication auth = getAuthentication();
if (auth != null) {
LoginUser user = (LoginUser) auth.getPrincipal();
return user.getUser().getSubStoreIds().contains(storeId);
}
} catch (Exception e) {
log.error("判断档口管理权限异常", e);
}
return false;
}
/**
* /
*
* @param storeId
* @return
*/
public static boolean isStoreManagerOrSub(Long storeId) {
if (storeId == null) {
return false;
}
try {
Authentication auth = getAuthentication();
if (auth != null) {
LoginUser user = (LoginUser) auth.getPrincipal();
return user.getUser().getManagedStoreIds().contains(storeId)
|| user.getUser().getSubStoreIds().contains(storeId);
}
} catch (Exception e) {
log.error("判断档口管理权限异常", e);
}
return false;
}
/**
*
*