Unverified Commit 98a7daa6 authored by Tboy's avatar Tboy Committed by GitHub
Browse files

Merge pull request #8 from apache/dev

merge
parents cfd3266c d3d5726a
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
#
# 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.
#

name: SonarCloud
on: [push, pull_request]
jobs:
  sonarCloudTrigger:
    name: SonarCloud Trigger
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v1
      with:
        java-version: 8
    - uses: actions/cache@v1
      with:
        path: ~/.m2/repository
        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-sonarqube
        restore-keys: |
          ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-sonarqube
          ${{ runner.os }}-maven-
    - name: Maven clean
      run: mvn clean
    - name: Run SonarCloud analyse
      run: >
          mvn clean --batch-mode
          org.jacoco:jacoco-maven-plugin:prepare-agent
          verify
          org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
          -Dmaven.test.skip=true
          -Dsonar.host.url=https://sonarcloud.io
          -Dsonar.organization=apache
          -Dsonar.projectKey=apache-dolphinscheduler
          -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@ Dolphin Scheduler Official Website
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Total Lines](https://tokei.rs/b1/github/apache/Incubator-DolphinScheduler?category=lines)](https://github.com/apache/Incubator-DolphinScheduler)
[![codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/branch/dev/graph/badge.svg)](https://codecov.io/gh/apache/incubator-dolphinscheduler/branch/dev)
![Codacy Badge](https://api.codacy.com/project/badge/Grade/ae514bfb7bb049658e916da091928e62)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache-dolphinscheduler&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler)


> Dolphin Scheduler for Big Data

+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ Dolphin Scheduler Official Website
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Total Lines](https://tokei.rs/b1/github/apache/Incubator-DolphinScheduler?category=lines)](https://github.com/apache/Incubator-DolphinScheduler)
[![codecov](https://codecov.io/gh/apache/incubator-dolphinscheduler/branch/dev/graph/badge.svg)](https://codecov.io/gh/apache/incubator-dolphinscheduler/branch/dev)
![Codacy Badge](https://api.codacy.com/project/badge/Grade/ae514bfb7bb049658e916da091928e62)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache-dolphinscheduler&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler)

> Dolphin Scheduler for Big Data

+14 −4
Original line number Diff line number Diff line
@@ -115,12 +115,12 @@ public class QueueService extends BaseService {
        }

        if (StringUtils.isEmpty(queue)) {
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, queue);
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "queue");
            return result;
        }

        if (StringUtils.isEmpty(queueName)) {
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, queueName);
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "queueName");
            return result;
        }

@@ -163,6 +163,16 @@ public class QueueService extends BaseService {
            return result;
        }

        if (StringUtils.isEmpty(queue)) {
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "queue");
            return result;
        }

        if (StringUtils.isEmpty(queueName)) {
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "queueName");
            return result;
        }

        Queue queueObj = queueMapper.selectById(id);
        if (queueObj == null) {
            putMsg(result, Status.QUEUE_NOT_EXIST, id);
@@ -222,12 +232,12 @@ public class QueueService extends BaseService {
        Result result = new Result();

        if (StringUtils.isEmpty(queue)) {
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, queue);
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "queue");
            return result;
        }

        if (StringUtils.isEmpty(queueName)) {
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, queueName);
            putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "queueName");
            return result;
        }

+45 −4
Original line number Diff line number Diff line
@@ -221,9 +221,13 @@ public class UsersService extends BaseService {
            return result;
        }

        Date now = new Date();

        if (StringUtils.isNotEmpty(userName)) {

            if (!CheckUtils.checkUserName(userName)){
                putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,userName);
                return result;
            }

            User tempUser = userMapper.queryByUserNameAccurately(userName);
            if (tempUser != null && tempUser.getId() != userId) {
                putMsg(result, Status.USER_NAME_EXIST);
@@ -233,14 +237,30 @@ public class UsersService extends BaseService {
        }

        if (StringUtils.isNotEmpty(userPassword)) {
            if (!CheckUtils.checkPassword(userPassword)){
                putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,userPassword);
                return result;
            }
            user.setUserPassword(EncryptionUtils.getMd5(userPassword));
        }

        if (StringUtils.isNotEmpty(email)) {
            if (!CheckUtils.checkEmail(email)){
                putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,email);
                return result;
            }
            user.setEmail(email);
        }
        user.setQueue(queue);

        if (StringUtils.isNotEmpty(phone)) {
            if (!CheckUtils.checkPhone(phone)){
                putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR,phone);
                return result;
            }
            user.setPhone(phone);
        }
        user.setQueue(queue);
        Date now = new Date();
        user.setUpdateTime(now);

        //if user switches the tenant, the user's resources need to be copied to the new tenant
@@ -318,10 +338,15 @@ public class UsersService extends BaseService {
        Map<String, Object> result = new HashMap<>(5);
        //only admin can operate
        if (!isAdmin(loginUser)) {
            putMsg(result, Status.USER_NO_OPERATION_PERM, id);
            return result;
        }
        //check exist
        User tempUser = userMapper.selectById(id);
        if (tempUser == null) {
            putMsg(result, Status.USER_NOT_EXIST, id);
            return result;
        }

        // delete user
        User user = userMapper.queryTenantCodeByUserId(id);

@@ -357,6 +382,12 @@ public class UsersService extends BaseService {
            return result;
        }

        //check exist
        User tempUser = userMapper.selectById(userId);
        if (tempUser == null) {
            putMsg(result, Status.USER_NOT_EXIST, userId);
            return result;
        }
        //if the selected projectIds are empty, delete all items associated with the user
        projectUserMapper.deleteProjectRelation(0, userId);

@@ -443,6 +474,11 @@ public class UsersService extends BaseService {
        if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
            return result;
        }
        User user = userMapper.selectById(userId);
        if(user == null){
            putMsg(result, Status.USER_NOT_EXIST, userId);
            return result;
        }

        udfUserMapper.deleteByUserId(userId);

@@ -485,6 +521,11 @@ public class UsersService extends BaseService {
        if (check(result, !isAdmin(loginUser), Status.USER_NO_OPERATION_PERM)) {
            return result;
        }
        User user = userMapper.selectById(userId);
        if(user == null){
            putMsg(result, Status.USER_NOT_EXIST, userId);
            return result;
        }

        datasourceUserMapper.deleteByUserId(userId);

Loading