Просмотр исходного кода

设置当前企业角色bug处理与权限优化

Hu Jie 7 лет назад
Родитель
Сommit
e987e2844a

+ 3 - 1
src/main/java/com/uas/platform/b2c/common/account/controller/AuthenticationController.java

@@ -132,7 +132,9 @@ public class AuthenticationController {
 		String currUrl;
 		try {
 			currUrl = URLDecoder.decode(resUrl, "UTF-8");
-			currUrl = "/" + currUrl;
+			if (!currUrl.substring(0,1).equals("/")) {
+				currUrl = "/" + currUrl;
+			}
 		} catch (UnsupportedEncodingException e) {
 			throw new IllegalArgumentException("URL编码错误!");
 		}

+ 13 - 5
src/main/java/com/uas/platform/b2c/common/account/model/User.java

@@ -501,12 +501,20 @@ public class User implements Serializable {
 	 */
 	public void setCurrentEnterpriseRoles() {
 		if(!CollectionUtils.isEmpty(this.roles) && this.enterprise != null) {
-			Iterator<Role> iterator = this.roles.iterator();
+//			Iterator<Role> iterator = this.roles.iterator();
+//			Long enuu = this.enterprise.getUu();
+//			while (iterator.hasNext()) {
+//				Role role = iterator.next();
+//				if(!role.getEnUU().equals(enuu)) {
+//					iterator.remove();
+//				}
+//			}
+			Set<Role> roles = this.roles;
+			this.roles = new HashSet<>();
 			Long enuu = this.enterprise.getUu();
-			while (iterator.hasNext()) {
-				Role role = iterator.next();
-				if(!role.getEnUU().equals(enuu)) {
-					iterator.remove();
+			for (Role role : roles) {
+				if (role.getEnUU().equals(enuu)) {
+					this.roles.add(role);
 				}
 			}
 		}

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java

@@ -558,7 +558,7 @@ public class UserServiceImpl implements UserService {
 		}
 		ModelMap map = new ModelMap();
 		map.put("status","fail");
-		map.put("msg","没有该权限,请联系管理员");
+		map.put("msg","没有该权限,请联系管理员");
 		return map;
 	}
 }