forked from DataLinkDC/dinky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature-1641][admin,client] Add Flink row level permissions (DataLin…
…kDC#1831) Co-authored-by: wenmo <32723967+wenmo@users.noreply.github.com>
- Loading branch information
Showing
41 changed files
with
2,963 additions
and
21 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
dinky-admin/src/main/java/org/dinky/controller/RoleSelectPermissionsController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.controller; | ||
|
||
import org.dinky.common.result.ProTableResult; | ||
import org.dinky.common.result.Result; | ||
import org.dinky.model.RoleSelectPermissions; | ||
import org.dinky.service.RoleSelectPermissionsService; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequestMapping("/api/roleSelectPermissions") | ||
public class RoleSelectPermissionsController { | ||
|
||
@Autowired private RoleSelectPermissionsService roleSelectPermissionsService; | ||
|
||
/** create or update roleSelectPermissions */ | ||
@PutMapping | ||
public Result saveOrUpdateRole(@RequestBody RoleSelectPermissions roleSelectPermissions) { | ||
if (roleSelectPermissionsService.saveOrUpdate(roleSelectPermissions)) { | ||
return Result.succeed("新增成功"); | ||
} else { | ||
return Result.failed("新增失败"); | ||
} | ||
} | ||
|
||
/** delete roleSelectPermissions by id */ | ||
@DeleteMapping | ||
public Result deleteMul(@RequestBody JsonNode para) { | ||
if (para.size() > 0) { | ||
List<Integer> error = new ArrayList<>(); | ||
for (final JsonNode item : para) { | ||
Integer id = item.asInt(); | ||
if (!roleSelectPermissionsService.removeById(id)) { | ||
error.add(id); | ||
} | ||
} | ||
if (error.size() == 0) { | ||
return Result.succeed("删除成功"); | ||
} else { | ||
return Result.succeed( | ||
"删除部分成功,但" + error.toString() + "删除失败,共" + error.size() + "次失败。"); | ||
} | ||
} else { | ||
return Result.failed("请选择要删除的记录"); | ||
} | ||
} | ||
|
||
/** query roleSelectPermissions list */ | ||
@PostMapping | ||
public ProTableResult<RoleSelectPermissions> listRoles(@RequestBody JsonNode para) { | ||
return roleSelectPermissionsService.selectForProTable(para); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
dinky-admin/src/main/java/org/dinky/mapper/RoleSelectPermissionsMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.mapper; | ||
|
||
import org.dinky.db.mapper.SuperMapper; | ||
import org.dinky.model.RoleSelectPermissions; | ||
|
||
import org.apache.ibatis.annotations.Mapper; | ||
import org.apache.ibatis.annotations.Param; | ||
|
||
import java.util.List; | ||
|
||
/** role select permissions mapper interface */ | ||
@Mapper | ||
public interface RoleSelectPermissionsMapper extends SuperMapper<RoleSelectPermissions> { | ||
|
||
/** | ||
* delete user role select permissions by role id | ||
* | ||
* @param roleIds role id | ||
* @return delete status | ||
*/ | ||
int deleteByRoleIds(@Param("roleIds") List<Integer> roleIds); | ||
|
||
/** | ||
* select user role data permissions by role ids | ||
* | ||
* @param roleIds role ids | ||
* @return List<RoleSelectPermissions> | ||
*/ | ||
List<RoleSelectPermissions> listRoleSelectPermissionsByRoleIds( | ||
@Param("roleIds") List<Integer> roleIds); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
dinky-admin/src/main/java/org/dinky/model/RoleSelectPermissions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.model; | ||
|
||
import java.io.Serializable; | ||
import java.time.LocalDateTime; | ||
|
||
import com.baomidou.mybatisplus.annotation.FieldFill; | ||
import com.baomidou.mybatisplus.annotation.IdType; | ||
import com.baomidou.mybatisplus.annotation.TableField; | ||
import com.baomidou.mybatisplus.annotation.TableId; | ||
import com.baomidou.mybatisplus.annotation.TableName; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = false) | ||
@TableName("dinky_role_select_permissions") | ||
public class RoleSelectPermissions implements Serializable { | ||
|
||
private static final long serialVersionUID = 8676666963206334660L; | ||
|
||
/** id */ | ||
@TableId(value = "id", type = IdType.AUTO) | ||
private Integer id; | ||
|
||
/** role id */ | ||
private Integer roleId; | ||
|
||
/** table_name */ | ||
private String tableName; | ||
|
||
/** expression */ | ||
private String expression; | ||
|
||
/** create time */ | ||
@TableField(fill = FieldFill.INSERT) | ||
private LocalDateTime createTime; | ||
|
||
/** update time */ | ||
@TableField(fill = FieldFill.INSERT_UPDATE) | ||
private LocalDateTime updateTime; | ||
|
||
/** role code */ | ||
@TableField(exist = false) | ||
private String roleCode; | ||
|
||
/** role name */ | ||
@TableField(exist = false) | ||
private String roleName; | ||
} |
52 changes: 52 additions & 0 deletions
52
dinky-admin/src/main/java/org/dinky/service/RoleSelectPermissionsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.dinky.service; | ||
|
||
import org.dinky.db.service.ISuperService; | ||
import org.dinky.model.RoleSelectPermissions; | ||
|
||
import java.util.List; | ||
|
||
public interface RoleSelectPermissionsService extends ISuperService<RoleSelectPermissions> { | ||
|
||
/** | ||
* delete user role select permissions by role id | ||
* | ||
* @param roleIds role id | ||
* @return delete status | ||
*/ | ||
boolean deleteByRoleIds(List<Integer> roleIds); | ||
|
||
/** | ||
* select user role data permissions by role id | ||
* | ||
* @param roleId role id | ||
* @return List<RoleSelectPermissions> | ||
*/ | ||
List<RoleSelectPermissions> listAllByRoleId(Integer roleId); | ||
|
||
/** | ||
* select user role data permissions by role ids | ||
* | ||
* @param roleIds role ids | ||
* @return List<RoleSelectPermissions> | ||
*/ | ||
List<RoleSelectPermissions> listRoleSelectPermissionsByRoleIds(List<Integer> roleIds); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.