| | |
| | | package com.iailab.framework.security.core.service; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.HashUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.iailab.framework.common.core.KeyValue; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.cache.CacheUtils; |
| | | import com.iailab.framework.security.core.LoginUser; |
| | | import com.iailab.framework.security.core.util.SecurityFrameworkUtils; |
| | | import com.iailab.module.system.api.permission.PermissionApi; |
| | |
| | | @Override |
| | | @SneakyThrows |
| | | public boolean hasAnyPermissions(String... permissions) { |
| | | return hasAnyPermissionsCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(permissions))); |
| | | Long userId = getLoginUserId(); |
| | | if (userId == null) { |
| | | return false; |
| | | } |
| | | return hasAnyPermissionsCache.get(new KeyValue<>(userId, Arrays.asList(permissions))); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | @SneakyThrows |
| | | public boolean hasAnyRoles(String... roles) { |
| | | return hasAnyRolesCache.get(new KeyValue<>(getLoginUserId(), Arrays.asList(roles))); |
| | | Long userId = getLoginUserId(); |
| | | if (userId == null) { |
| | | return false; |
| | | } |
| | | return hasAnyRolesCache.get(new KeyValue<>(userId, Arrays.asList(roles))); |
| | | } |
| | | |
| | | @Override |