diable operate admin user
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -58,3 +58,6 @@ pnpm-debug.log*
|
||||
*.sln
|
||||
*.sw?
|
||||
/ui/node
|
||||
/logs
|
||||
/LOGGING_HOME_IS_UNDEFINED
|
||||
*.log
|
||||
@@ -88,9 +88,15 @@ public class AclServiceImpl implements AclService, SmartInitializingSingleton {
|
||||
List<AclBinding> aclBindingList = entry.isNull() ? aclConsole.getAclList(null) : aclConsole.getAclList(entry);
|
||||
List<AclEntry> entryList = aclBindingList.stream().map(x -> AclEntry.valueOf(x)).collect(Collectors.toList());
|
||||
Map<String, List<AclEntry>> entryMap = entryList.stream().collect(Collectors.groupingBy(AclEntry::getPrincipal));
|
||||
Map<String, Map<String, List<AclEntry>>> resultMap = new HashMap<>();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
entryMap.forEach((k, v) -> {
|
||||
Map<String, List<AclEntry>> map = v.stream().collect(Collectors.groupingBy(e -> e.getResourceType() + "#" + e.getName()));
|
||||
if (k.equals(kafkaConfig.getAdminUsername())) {
|
||||
Map<String, Object> map2 = new HashMap<>(map);
|
||||
Map<String, Object> userMap = new HashMap<>();
|
||||
userMap.put("role", "admin");
|
||||
map2.put("USER", userMap);
|
||||
}
|
||||
resultMap.put(k, map);
|
||||
});
|
||||
if (entry.isNull() || StringUtils.isNotBlank(entry.getPrincipal())) {
|
||||
@@ -98,7 +104,15 @@ public class AclServiceImpl implements AclService, SmartInitializingSingleton {
|
||||
|
||||
detailList.values().forEach(u -> {
|
||||
if (!resultMap.containsKey(u.name()) && !u.credentialInfos().isEmpty()) {
|
||||
resultMap.put(u.name(), Collections.emptyMap());
|
||||
if (!u.name().equals(kafkaConfig.getAdminUsername())) {
|
||||
resultMap.put(u.name(), Collections.emptyMap());
|
||||
} else {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
Map<String, Object> userMap = new HashMap<>();
|
||||
userMap.put("role", "admin");
|
||||
map2.put("USER", userMap);
|
||||
resultMap.put(u.name(), map2);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ const routes = [
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: "history",
|
||||
// mode: "history",
|
||||
mode: "hash",
|
||||
base: process.env.BASE_URL,
|
||||
routes,
|
||||
});
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
></UpdateUser>
|
||||
</div>
|
||||
<a-table :columns="columns" :data-source="data" bordered>
|
||||
<a slot="operation" slot-scope="record">
|
||||
<a
|
||||
slot="operation"
|
||||
slot-scope="record"
|
||||
v-show="!record.user || record.user.role != 'admin'"
|
||||
>
|
||||
<a-popconfirm
|
||||
:title="'删除用户: ' + record.username + '及相关权限?'"
|
||||
ok-text="确认"
|
||||
@@ -241,6 +245,7 @@ function getAclList(data, requestParameters) {
|
||||
username: k,
|
||||
topicList: topicList.join(", "),
|
||||
groupList: groupList.join(", "),
|
||||
user: response.data.map[k]["USER"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user