| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.mapper.PermissionMapper; |
| | | import com.whyc.mapper.RoleMapper; |
| | | import com.whyc.mapper.SecurityMapper; |
| | | import com.whyc.mapper.UserMapper; |
| | | import com.whyc.pojo.Permission; |
| | | import com.whyc.pojo.Role; |
| | | import com.whyc.pojo.User; |
| | | import org.apache.shiro.authz.AuthorizationInfo; |
| | | import org.apache.shiro.authz.SimpleAuthorizationInfo; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | } |
| | | } |
| | | |
| | | @Cacheable(cacheNames = "authorizationCache",key = "#root.method") |
| | | public AuthorizationInfo getAuthorizationInfo(User user) { |
| | | SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); |
| | | //添加Roles和Permissions |
| | |
| | | |
| | | private List<String> findPermissionsByUserId(int userId) { |
| | | QueryWrapper<Permission> query = Wrappers.query(); |
| | | List<String> perms = null; |
| | | List<String> perms = new LinkedList<>(); |
| | | //perms.add("water:all"); |
| | | return perms; |
| | | } |
| | | |
| | | private List<String> findRolesByUserId(int userId) { |
| | | List<String> roles = null; |
| | | List<String> roles = new LinkedList<>(); |
| | | //roles.add("dev"); |
| | | return roles; |
| | | } |
| | | } |