开启集群数据权限,同一浏览器不同账号登录看到其它账号集群信息bug fixed.
This commit is contained in:
@@ -33,4 +33,9 @@ public class AuthController {
|
|||||||
public ResponseData login(@RequestBody LoginUserDTO userDTO) {
|
public ResponseData login(@RequestBody LoginUserDTO userDTO) {
|
||||||
return authService.login(userDTO);
|
return authService.login(userDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/own/data/auth")
|
||||||
|
public boolean ownDataAuthority() {
|
||||||
|
return authService.ownDataAuthority();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,6 @@ import com.xuxd.kafka.console.beans.dto.LoginUserDTO;
|
|||||||
public interface AuthService {
|
public interface AuthService {
|
||||||
|
|
||||||
ResponseData login(LoginUserDTO userDTO);
|
ResponseData login(LoginUserDTO userDTO);
|
||||||
|
|
||||||
|
boolean ownDataAuthority();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,4 +93,16 @@ public class AuthServiceImpl implements AuthService {
|
|||||||
return ResponseData.create().data(loginResult).success();
|
return ResponseData.create().data(loginResult).success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean ownDataAuthority() {
|
||||||
|
if (!authConfig.isEnable()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!authConfig.isEnableClusterAuthority()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
setPermissions,
|
setPermissions,
|
||||||
setToken,
|
setToken,
|
||||||
setUsername,
|
setUsername,
|
||||||
|
deleteClusterInfo,
|
||||||
} from "@/utils/local-cache";
|
} from "@/utils/local-cache";
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
@@ -38,6 +39,9 @@ export default new Vuex.Store({
|
|||||||
state.clusterInfo.enableSasl = enableSasl;
|
state.clusterInfo.enableSasl = enableSasl;
|
||||||
setClusterInfo(clusterInfo);
|
setClusterInfo(clusterInfo);
|
||||||
},
|
},
|
||||||
|
[CLUSTER.DELETE]() {
|
||||||
|
deleteClusterInfo();
|
||||||
|
},
|
||||||
[AUTH.ENABLE](state, enable) {
|
[AUTH.ENABLE](state, enable) {
|
||||||
state.auth.enable = enable;
|
state.auth.enable = enable;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export const CLUSTER = {
|
export const CLUSTER = {
|
||||||
SWITCH: "switchCluster",
|
SWITCH: "switchCluster",
|
||||||
|
DELETE: "deleteClusterInfo",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AUTH = {
|
export const AUTH = {
|
||||||
|
|||||||
@@ -365,6 +365,10 @@ export const AuthApi = {
|
|||||||
url: "/auth/login",
|
url: "/auth/login",
|
||||||
method: "post",
|
method: "post",
|
||||||
},
|
},
|
||||||
|
ownDataAuthority: {
|
||||||
|
url: "/auth/own/data/auth",
|
||||||
|
method: "get",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ClusterRoleRelationApi = {
|
export const ClusterRoleRelationApi = {
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ export function setClusterInfo(clusterInfo) {
|
|||||||
localStorage.setItem(Cache.clusterInfo, JSON.stringify(clusterInfo));
|
localStorage.setItem(Cache.clusterInfo, JSON.stringify(clusterInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function deleteClusterInfo() {
|
||||||
|
localStorage.removeItem(Cache.clusterInfo);
|
||||||
|
}
|
||||||
|
|
||||||
export function getClusterInfo() {
|
export function getClusterInfo() {
|
||||||
const str = localStorage.getItem(Cache.clusterInfo);
|
const str = localStorage.getItem(Cache.clusterInfo);
|
||||||
return str ? JSON.parse(str) : undefined;
|
return str ? JSON.parse(str) : undefined;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import request from "@/utils/request";
|
|||||||
import { AuthApi } from "@/utils/api";
|
import { AuthApi } from "@/utils/api";
|
||||||
import notification from "ant-design-vue/lib/notification";
|
import notification from "ant-design-vue/lib/notification";
|
||||||
import { mapMutations } from "vuex";
|
import { mapMutations } from "vuex";
|
||||||
import { AUTH } from "@/store/mutation-types";
|
import { AUTH, CLUSTER } from "@/store/mutation-types";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Login",
|
name: "Login",
|
||||||
@@ -88,8 +88,19 @@ export default {
|
|||||||
setToken: AUTH.SET_TOKEN,
|
setToken: AUTH.SET_TOKEN,
|
||||||
setUsername: AUTH.SET_USERNAME,
|
setUsername: AUTH.SET_USERNAME,
|
||||||
setPermissions: AUTH.SET_PERMISSIONS,
|
setPermissions: AUTH.SET_PERMISSIONS,
|
||||||
|
deleteClusterInfo: CLUSTER.DELETE,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
request({
|
||||||
|
url: AuthApi.ownDataAuthority.url,
|
||||||
|
method: AuthApi.ownDataAuthority.method,
|
||||||
|
}).then((res) => {
|
||||||
|
if (!res) {
|
||||||
|
this.deleteClusterInfo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user