فهرست منبع

Merge branch 'yht' of yinet2020/jeesite into master

yuhuitao 2 سال پیش
والد
کامیت
c94de16a17
1فایلهای تغییر یافته به همراه18 افزوده شده و 2 حذف شده
  1. 18 2
      modules/sso/src/main/java/com/jeesite/modules/sso/web/SsoAppController.java

+ 18 - 2
modules/sso/src/main/java/com/jeesite/modules/sso/web/SsoAppController.java

@@ -4,7 +4,9 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import com.jeesite.modules.sys.entity.Role;
+import com.jeesite.modules.sys.entity.User;
 import com.jeesite.modules.sys.service.RoleService;
+import com.jeesite.modules.sys.utils.UserUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
@@ -24,6 +26,7 @@ import com.jeesite.common.web.BaseController;
 import com.jeesite.modules.sso.entity.SsoApp;
 import com.jeesite.modules.sso.service.SsoAppService;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 import java.util.stream.Collectors;
@@ -203,9 +206,22 @@ public class SsoAppController extends BaseController {
 	 */
 	@RequestMapping(value = "ssoApp")
 	public List<SsoApp> ssoApp(SsoApp ssoApp) {
+		//获取用户权限
+		User user = UserUtils.getUser();
+		List<Role> roleList = user.getRoleList();
+
 		ssoApp.setAppStatus("0");
-		ssoAppService.findList(ssoApp);
-		return ssoAppService.findList(ssoApp);
+		List<SsoApp> list = ssoAppService.findList(ssoApp);
+		List<SsoApp> list1=new ArrayList<>();
+		for (Role role : roleList) {
+			for (SsoApp app : list) {
+				if(app.getAuthority().contains(role.getRoleCode())){
+					list1.add(app);
+				}
+			}
+		}
+
+		return list1;
 	}