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