* 根据用户名查找其权限
* @param username
* @return
*/
public Set<String> findPermissions(String appKey, String username) {
User user = userService.findByUsername(username);
if(user == null) {
return Collections.EMPTY_SET;
}
Long appId = appService.findAppIdByAppKey(appKey);
if(appId == null) {
return Collections.EMPTY_SET;
}
Authorization authorization = authorizationDao.findByAppUser(appId, user.getId());
if(authorization == null) {
return Collections.EMPTY_SET;
}
return roleService.findPermissions(authorization.getRoleIds().toArray(new Long[0]));
}