From 2618ac5661aeb3ce0381b0761d4536bbf54e5671 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 24 Feb 2023 17:34:10 +0900 Subject: [PATCH 01/10] =?UTF-8?q?test:=20Github=20Action=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9501566..7cfa881 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,6 +44,7 @@ jobs: MYSQL_VERSION: ${{ matrix.mysql }} MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: cakephp_test + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 From fa3961002a5d76e56805d1759ecfcf39fe4b81cd Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 26 Feb 2023 08:18:54 +0900 Subject: [PATCH 02/10] change: Version number to 3.3.6 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index fa7adc7..9c25013 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.5 +3.3.6 From 177185656236f79b24c5588c9f17dccff3e62b5f Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Thu, 6 Apr 2023 18:24:44 +0900 Subject: [PATCH 03/10] =?UTF-8?q?fix:=20=E6=8E=B2=E7=A4=BA=E6=9D=BF?= =?UTF-8?q?=E3=81=A7=E3=80=81=E5=85=AC=E9=96=8B=E6=A8=A9=E9=99=90=E3=81=8C?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=83=A6=E3=83=BC=E3=82=B6=E8=BF=94=E4=BF=A1?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A8=E3=80=81=E8=A1=A8=E7=A4=BA=E3=83=BB?= =?UTF-8?q?=E7=B7=A8=E9=9B=86=E3=83=BB=E5=89=8A=E9=99=A4=E3=81=8C=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=81=AA=E3=81=8F=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://github.?= =?UTF-8?q?com/researchmap/RmNetCommons3/issues/2806?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/WorkflowBehavior.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Model/Behavior/WorkflowBehavior.php b/Model/Behavior/WorkflowBehavior.php index 94d1640..ac32061 100644 --- a/Model/Behavior/WorkflowBehavior.php +++ b/Model/Behavior/WorkflowBehavior.php @@ -227,16 +227,23 @@ private function __hasSaveField(Model $model, $needle) { * * @param Model $model Model using this behavior * @param array $conditions Model::find conditions default value + * @param bool $useCommentCreatable コメントの作成権限でもチェックするかどうか * @return array Conditions data * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.BooleanArgumentFlag) */ - public function getWorkflowConditions(Model $model, $conditions = array()) { + public function getWorkflowConditions( + Model $model, + $conditions = array(), + $useCommentCreatable = false + ) { if (Current::permission('content_editable')) { $activeConditions = array(); $latestConditons = array( $model->alias . '.is_latest' => true, ); - } elseif (Current::permission('content_creatable')) { + } elseif (Current::permission('content_creatable') || + $useCommentCreatable && Current::permission('content_comment_creatable')) { $activeConditions = array( $model->alias . '.is_active' => true, $model->alias . '.created_user !=' => Current::read('User.id'), @@ -318,12 +325,19 @@ public function getWorkflowConditions(Model $model, $conditions = array()) { * @param Model $model Model using this behavior * @param string $type Type of find operation (all / first / count / neighbors / list / threaded) * @param array $query Option fields (conditions / fields / joins / limit / offset / order / page / group / callbacks) + * @param bool $useCommentCreatable コメントの作成権限でもチェックするかどうか * @return array Conditions data + * @SuppressWarnings(PHPMD.BooleanArgumentFlag) */ - public function getWorkflowContents(Model $model, $type, $query = array()) { + public function getWorkflowContents( + Model $model, + $type, + $query = array(), + $useCommentCreatable = false + ) { $query = Hash::merge(array( 'recursive' => -1, - 'conditions' => $this->getWorkflowConditions($model) + 'conditions' => $this->getWorkflowConditions($model, [], $useCommentCreatable) ), $query); return $model->find($type, $query); @@ -384,7 +398,8 @@ public function canEditWorkflowContent(Model $model, $data) { * @return bool true:削除可、false:削除不可 */ public function canDeleteWorkflowContent(Model $model, $data) { - if (! $this->canEditWorkflowContent($model, $data)) { + //Model側で継承している場合、そのcanEditWorkflowContentが実行されるように、$thisではなく、$modelで呼び出す。 + if (! $model->canEditWorkflowContent($data)) { return false; } if (Current::permission('content_publishable')) { From 5f024cfc38bee88028587ce9d1309a147324e86b Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 7 Apr 2023 09:22:17 +0900 Subject: [PATCH 04/10] =?UTF-8?q?test:=20=E3=80=8CWaiting=20for=20a=20runn?= =?UTF-8?q?er=20to=20pick=20up=20this=20job...=E3=80=8D=E3=81=8C=E3=81=A7?= =?UTF-8?q?=E3=81=A6Github=20Action=E3=81=8C=E5=8B=95=E3=81=8B=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7cfa881..3b2212b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ name: tests jobs: setup: name: setup - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: Slack Notification on Start uses: rtCamp/action-slack-notify@v2.2.0 @@ -28,7 +28,7 @@ jobs: tests: name: tests needs: setup - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: matrix: php: [ '7.1', '7.2', '7.3', '7.4' ] @@ -148,7 +148,7 @@ jobs: teardown: name: teardown - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: tests steps: # テスト成功時はこちらのステップが実行される From 7cf37287ff9bd5235231c495fefb356dc1e71885 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 7 Apr 2023 09:22:55 +0900 Subject: [PATCH 05/10] =?UTF-8?q?test:=20phpcs=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/WorkflowBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Behavior/WorkflowBehavior.php b/Model/Behavior/WorkflowBehavior.php index ac32061..325eeba 100644 --- a/Model/Behavior/WorkflowBehavior.php +++ b/Model/Behavior/WorkflowBehavior.php @@ -236,7 +236,7 @@ public function getWorkflowConditions( Model $model, $conditions = array(), $useCommentCreatable = false - ) { + ) { if (Current::permission('content_editable')) { $activeConditions = array(); $latestConditons = array( From 11504b7641c452389fa91ec3f38161255e8a9c2f Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 7 Apr 2023 09:30:13 +0900 Subject: [PATCH 06/10] =?UTF-8?q?test:=20github=20action=E3=81=A7=E9=80=94?= =?UTF-8?q?=E4=B8=AD=E3=81=A7=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=82=82=E5=BE=8C=E7=B6=9A=E3=81=AB=E9=80=B2?= =?UTF-8?q?=E3=82=80=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3b2212b..7ca9b19 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -92,37 +92,44 @@ jobs: docker-compose exec -T nc3app bash /opt/scripts/app-build.sh - name: phpcs (PHP CodeSniffer) + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose exec -T nc3app bash /opt/scripts/phpcs.sh - name: phpmd (PHP Mess Detector) + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose exec -T nc3app bash /opt/scripts/phpmd.sh - name: phpcpd (PHP Copy/Paste Detector) + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose exec -T nc3app bash /opt/scripts/phpcpd.sh - name: gjslint (JavaScript Style Check) + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose exec -T nc3app bash /opt/scripts/gjslint.sh - name: phpdoc (PHP Documentor) + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose exec -T nc3app bash /opt/scripts/phpdoc.sh - name: phpunit (PHP UnitTest) + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose exec -T nc3app bash /opt/scripts/phpunit.sh sudo -s chmod a+w -R ${NC3_BUILD_DIR}/build - name: push coveralls + if: success() env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_FLAG_NAME: ${{ matrix.php }} From a26177fb494a5e08386eebb96412a87695778331 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 7 Apr 2023 09:36:11 +0900 Subject: [PATCH 07/10] =?UTF-8?q?test:=20github=20action=E3=81=A7=E9=80=94?= =?UTF-8?q?=E4=B8=AD=E3=81=A7=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=82=82=E5=BE=8C=E7=B6=9A=E3=81=AB=E9=80=B2?= =?UTF-8?q?=E3=82=80=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7ca9b19..77f9121 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -139,6 +139,7 @@ jobs: vendors/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v - name: docker-compose remove + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose rm -f From ce0258bec443361efa6973843cea58eab5b5c4f9 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 7 Apr 2023 09:38:03 +0900 Subject: [PATCH 08/10] =?UTF-8?q?test:=20phpmd=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/Behavior/WorkflowBehavior.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Model/Behavior/WorkflowBehavior.php b/Model/Behavior/WorkflowBehavior.php index 325eeba..5d55d44 100644 --- a/Model/Behavior/WorkflowBehavior.php +++ b/Model/Behavior/WorkflowBehavior.php @@ -18,6 +18,7 @@ * * @author Shohei Nakajima * @package NetCommons\Workflow\Model\Befavior + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ class WorkflowBehavior extends ModelBehavior { From bee00507edbb79455eec2c2bf52489393fab4dc6 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 6 Oct 2023 13:51:14 +0900 Subject: [PATCH 09/10] =?UTF-8?q?test:=20github=20action=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 77f9121..6da4321 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,12 +3,10 @@ on: branches: - main - master - - availability pull_request: branches: - main - master - - availability name: tests @@ -19,6 +17,7 @@ jobs: steps: - name: Slack Notification on Start uses: rtCamp/action-slack-notify@v2.2.0 + if: env.SLACK_WEBHOOK != '' env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} SLACK_CHANNEL: notify-nc3-tests @@ -128,15 +127,14 @@ jobs: docker-compose exec -T nc3app bash /opt/scripts/phpunit.sh sudo -s chmod a+w -R ${NC3_BUILD_DIR}/build - - name: push coveralls - if: success() - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_FLAG_NAME: ${{ matrix.php }} - run: | - cd ${NC3_BUILD_DIR} - ls -la ${NC3_BUILD_DIR} - vendors/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v +# - name: push coveralls +# env: +# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# COVERALLS_FLAG_NAME: ${{ matrix.php }} +# run: | +# cd ${NC3_BUILD_DIR} +# ls -la ${NC3_BUILD_DIR} +# vendors/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v - name: docker-compose remove if: always() @@ -147,7 +145,7 @@ jobs: # テスト失敗時はこちらのステップが実行される - name: Slack Notification on Failure uses: rtCamp/action-slack-notify@v2.2.0 - if: failure() + if: env.SLACK_WEBHOOK != '' && failure() env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} SLACK_CHANNEL: notify-nc3-tests @@ -161,8 +159,8 @@ jobs: steps: # テスト成功時はこちらのステップが実行される - name: Slack Notification on Success - if: success() uses: rtCamp/action-slack-notify@v2.2.0 + if: env.SLACK_WEBHOOK != '' && success() env: SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} SLACK_CHANNEL: notify-nc3-tests From 056151f464036b095264103f6dc7ce80dbf96ccc Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Tue, 10 Oct 2023 01:16:27 +0900 Subject: [PATCH 10/10] change: Version number to 3.3.7 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 9c25013..86fb650 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.6 +3.3.7