break60 4 years ago
parent
commit
ea3c29aad9
  1. 10
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java
  2. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/BaseService.java
  3. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java
  4. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java
  5. 2
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java
  6. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
  7. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java

10
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertGroupService.java

@ -75,7 +75,7 @@ public class AlertGroupService extends BaseService{
public Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -103,7 +103,7 @@ public class AlertGroupService extends BaseService{
public Map<String, Object> createAlertgroup(User loginUser, String groupName, AlertType groupType, String desc) {
Map<String, Object> result = new HashMap<>();
//only admin can operate
if (checkAdmin(loginUser, result)){
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -140,7 +140,7 @@ public class AlertGroupService extends BaseService{
public Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, AlertType groupType, String desc) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)){
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -183,7 +183,7 @@ public class AlertGroupService extends BaseService{
result.put(Constants.STATUS, false);
//only admin can operate
if (checkAdmin(loginUser, result)){
if (isNotAdmin(loginUser, result)) {
return result;
}
//check exist
@ -213,7 +213,7 @@ public class AlertGroupService extends BaseService{
result.put(Constants.STATUS, false);
//only admin can operate
if (checkAdmin(loginUser, result)){
if (isNotAdmin(loginUser, result)) {
return result;
}

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/BaseService.java

@ -46,13 +46,13 @@ public class BaseService {
}
/**
* check admin
* isNotAdmin
*
* @param loginUser login user
* @param result result code
* @return true if administrator, otherwise false
* @return true if not administrator, otherwise false
*/
protected boolean checkAdmin(User loginUser, Map<String, Object> result) {
protected boolean isNotAdmin(User loginUser, Map<String, Object> result) {
//only admin can operate
if (!isAdmin(loginUser)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java

@ -60,7 +60,7 @@ public class QueueService extends BaseService {
*/
public Map<String, Object> queryList(User loginUser) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -82,7 +82,7 @@ public class QueueService extends BaseService {
*/
public Map<String, Object> queryList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -111,7 +111,7 @@ public class QueueService extends BaseService {
*/
public Map<String, Object> createQueue(User loginUser, String queue, String queueName) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -160,7 +160,7 @@ public class QueueService extends BaseService {
*/
public Map<String, Object> updateQueue(User loginUser, int id, String queue, String queueName) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}

12
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java

@ -1158,7 +1158,7 @@ public class ResourcesService extends BaseService {
public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId);
@ -1185,7 +1185,7 @@ public class ResourcesService extends BaseService {
public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId);
@ -1215,7 +1215,7 @@ public class ResourcesService extends BaseService {
public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(5);
//only admin can operate
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -1236,8 +1236,6 @@ public class ResourcesService extends BaseService {
}
/**
* authorized udf function
*
@ -1247,7 +1245,7 @@ public class ResourcesService extends BaseService {
*/
public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId);
@ -1266,7 +1264,7 @@ public class ResourcesService extends BaseService {
*/
public Map<String, Object> authorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)){
if (isNotAdmin(loginUser, result)) {
return result;
}
List<Resource> authedResources = resourcesMapper.queryAuthorizedResourceList(userId);

2
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java

@ -70,7 +70,7 @@ public class WorkerGroupService extends BaseService {
Integer toIndex = (pageNo - 1) * pageSize + pageSize;
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java

@ -293,7 +293,7 @@ public class ProjectServiceImpl extends BaseService implements ProjectService {
*/
public Map<String, Object> queryUnauthorizedProject(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
/**
@ -344,7 +344,7 @@ public class ProjectServiceImpl extends BaseService implements ProjectService {
public Map<String, Object> queryAuthorizedProject(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -364,7 +364,7 @@ public class ProjectServiceImpl extends BaseService implements ProjectService {
public Map<String, Object> queryProjectCreatedByUser(User loginUser) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java

@ -89,7 +89,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false);
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -141,7 +141,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
public Map<String, Object> queryTenantList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -174,7 +174,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
Map<String, Object> result = new HashMap<>(5);
result.put(Constants.STATUS, false);
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}
@ -235,7 +235,7 @@ public class TenantServiceImpl extends BaseService implements TenantService {
public Map<String, Object> deleteTenantById(User loginUser, int id) throws Exception {
Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)) {
if (isNotAdmin(loginUser, result)) {
return result;
}

Loading…
Cancel
Save