[feature][common]Add permission management to chat model.

This commit is contained in:
jerryjzhang
2025-03-10 23:58:19 +08:00
parent 0dbf56d357
commit 93d585c0d5
14 changed files with 65 additions and 15 deletions

View File

@@ -32,9 +32,12 @@ public class DatabaseReq extends RecordInfo {
private String description;
private String schema;
private String url;
private List<String> admins = Lists.newArrayList();
private List<String> viewers = Lists.newArrayList();
private Integer isOpen = 0;
}

View File

@@ -28,6 +28,8 @@ public class DatabaseResp extends RecordInfo {
private List<String> viewers = Lists.newArrayList();
private Integer isOpen = 0;
private String type;
private String url;
@@ -48,6 +50,10 @@ public class DatabaseResp extends RecordInfo {
private boolean hasEditPermission = false;
public boolean isPublic() {
return isOpen != null && isOpen == 1;
}
public String getHost() {
Pattern p = Pattern.compile("jdbc:(?<db>\\w+):.*((//)|@)(?<host>.+):(?<port>\\d+).*");
Matcher m = p.matcher(url);