add delete acl entry from acl detail

This commit is contained in:
许晓东
2021-09-04 18:21:47 +08:00
parent 399d67fd3c
commit bb8db4f6f3
6 changed files with 49 additions and 5 deletions

View File

@@ -72,6 +72,17 @@ public class AclAuthController {
return aclService.addConsumerAcl(param.toTopicEntry(), param.toGroupEntry());
}
/**
* delete acl .
*
* @param entry entry
* @return
*/
@DeleteMapping
public Object deleteAclByUser(@RequestBody AclEntry entry) {
return aclService.deleteAcl(entry);
}
/**
* delete user acl .
*

View File

@@ -123,7 +123,7 @@ public class AclServiceImpl implements AclService, SmartInitializingSingleton {
}
@Override public ResponseData deleteAcl(AclEntry entry) {
return aclConsole.deleteAcl(entry, false, false, false) ? ResponseData.create().success() : ResponseData.create().failed();
return aclConsole.deleteAcl(entry) ? ResponseData.create().success() : ResponseData.create().failed();
}
@Override public ResponseData addAcl(AclEntry entry) {

View File

@@ -121,6 +121,10 @@ class KafkaAclConsole(config: KafkaConfig) extends KafkaConsole(config: KafkaCon
}).asInstanceOf[Boolean]
}
def deleteAcl(entry: AclEntry): Boolean = {
deleteAcl(Collections.singleton(entry.toAclBindingFilter))
}
def deleteUserAcl(entry: AclEntry): Boolean = {
val filter: AclBindingFilter = entry.toAclBindingFilter
val delFilter = new AclBindingFilter(new ResourcePatternFilter(ResourceType.ANY, null, filter.patternFilter().patternType()),

View File

@@ -39,4 +39,8 @@ export const KafkaAclApi = {
url: "/acl/detail",
method: "post",
},
deleteAcl: {
url: "/acl",
method: "delete",
},
};

View File

@@ -328,7 +328,7 @@ function getAclList(data, requestParameters) {
}
const columns = [
{ title: "用户名", dataIndex: "username", key: "username" },
{ title: "用户名", dataIndex: "username", key: "username", width: 200 },
{
title: "topic列表",
dataIndex: "topicList",
@@ -347,6 +347,7 @@ const columns = [
title: "操作",
key: "operation",
scopedSlots: { customRender: "operation" },
width: 350,
},
];

View File

@@ -23,7 +23,16 @@
}
"
>>
<a slot="name" slot-scope="text">{{ text }}</a>
<a slot="action" slot-scope="record">
<a-popconfirm
:title="'删除操作权限: ' + record.operation + ''"
ok-text="确认"
cancel-text="取消"
@confirm="onDelete(record)"
>
<a-button>删除</a-button>
</a-popconfirm>
</a>
</a-table>
</div>
</a-modal>
@@ -98,8 +107,23 @@ export default {
this.$message.error(res.msg);
} else {
this.data = res.data.list;
// this.data.slice(0, data.length);
// this.data.push(...res.data.list);
}
});
},
onDelete(record) {
const param = Object.assign({}, record);
delete param["null"];
const api = KafkaAclApi.deleteAcl;
request({
url: api.url,
method: api.method,
data: param,
}).then((res) => {
if (res.code != 0) {
this.$message.error(res.msg);
} else {
this.$message.success(res.msg);
this.getAclDetail();
}
});
},