From d5564f85a3f8f1eb01492b0fb00f9dcb04c2936c Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 25 Jul 2018 12:14:17 +0900 Subject: [PATCH 01/31] =?UTF-8?q?=E3=80=8C=E6=8C=87=E5=AE=9A=E3=81=AA?= =?UTF-8?q?=E3=81=97=E3=80=8D=E3=82=92=E4=BC=9A=E5=93=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=81=8B=E3=82=89=E7=A7=BB=E5=8B=95=E3=80=82=20https://github.?= =?UTF-8?q?com/NetCommons3/NetCommons3/issues/1297?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locale/eng/LC_MESSAGES/user_manager.po | 8 -------- Locale/jpn/LC_MESSAGES/user_manager.po | 8 -------- Locale/user_manager.pot | 8 -------- 3 files changed, 24 deletions(-) diff --git a/Locale/eng/LC_MESSAGES/user_manager.po b/Locale/eng/LC_MESSAGES/user_manager.po index a3c4620..cc1b7aa 100644 --- a/Locale/eng/LC_MESSAGES/user_manager.po +++ b/Locale/eng/LC_MESSAGES/user_manager.po @@ -271,14 +271,6 @@ msgstr "" msgid "Required." msgstr "" -#: Users/View/Helper/UserSearchFormHelper.php:140 -msgid "Not specified" -msgstr "" - -#: Users/View/Helper/UserSearchFormHelper.php:186;303;333 -msgid "-- Not specify --" -msgstr "" - #: Users/View/Helper/UserSearchFormHelper.php:215 msgid "Not logged more than Xdays ago" msgstr "" diff --git a/Locale/jpn/LC_MESSAGES/user_manager.po b/Locale/jpn/LC_MESSAGES/user_manager.po index 22c0c9d..adef55d 100644 --- a/Locale/jpn/LC_MESSAGES/user_manager.po +++ b/Locale/jpn/LC_MESSAGES/user_manager.po @@ -281,14 +281,6 @@ msgstr "日以内にログインしている" msgid "Have logged in within %sdays" msgstr "%s日以内にログインしている" -#: UserManager/View/Elements/setting_tabs.ctp:30 -msgid "Not specified" -msgstr "条件に含まない" - -#: UserManager/View/Elements/setting_tabs.ctp:30 -msgid "-- Not specify --" -msgstr "-- 条件に含まない --" - #: UserManager/View/Elements/setting_tabs.ctp:30 msgid "No avatar." msgstr "なし" diff --git a/Locale/user_manager.pot b/Locale/user_manager.pot index a3c4620..cc1b7aa 100644 --- a/Locale/user_manager.pot +++ b/Locale/user_manager.pot @@ -271,14 +271,6 @@ msgstr "" msgid "Required." msgstr "" -#: Users/View/Helper/UserSearchFormHelper.php:140 -msgid "Not specified" -msgstr "" - -#: Users/View/Helper/UserSearchFormHelper.php:186;303;333 -msgid "-- Not specify --" -msgstr "" - #: Users/View/Helper/UserSearchFormHelper.php:215 msgid "Not logged more than Xdays ago" msgstr "" From 771f2c222c748fbd9e30e76eb0cc342f7c3b979b Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 5 Sep 2018 16:20:56 +0900 Subject: [PATCH 02/31] =?UTF-8?q?=E4=BC=9A=E5=93=A1=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=81=A7=E3=82=A2=E3=83=90=E3=82=BF=E3=83=BC=E3=81=8C=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=20https://github.?= =?UTF-8?q?com/NetCommons3/NetCommons3/issues/1334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UserManagerAvatarController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Controller/UserManagerAvatarController.php b/Controller/UserManagerAvatarController.php index c4bc4b4..6d52240 100644 --- a/Controller/UserManagerAvatarController.php +++ b/Controller/UserManagerAvatarController.php @@ -142,7 +142,7 @@ protected function _getBindParamsForUser() { 'className' => 'UploadFile', 'foreignKey' => false, 'conditions' => [ - 'UploadFile.plugin_key' => $this->plugin, + 'UploadFile.plugin_key' => 'users', 'UploadFile.content_key = User.id', 'UploadFile.field_name' => $this->request->params['field_name'], ], @@ -183,7 +183,7 @@ protected function _getQueryForPluginsRole() { $query = [ 'conditions' => [ 'PluginsRole.role_key' => AuthComponent::user('role_key'), - 'PluginsRole.plugin_key' => $this->plugin, + 'PluginsRole.plugin_key' => 'user_manager', ], 'recursive' => -1, 'callbacks' => false, From 3d005ab804e9f6c13135e73521996624313338ee Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 6 Jan 2019 17:46:08 +0900 Subject: [PATCH 03/31] =?UTF-8?q?PluginsRole=E3=81=AE=E3=82=AF=E3=82=A8?= =?UTF-8?q?=E3=83=AA=E7=B5=90=E6=9E=9C=E3=82=92=E3=82=AD=E3=83=A3=E3=83=83?= =?UTF-8?q?=E3=82=B7=E3=83=A5=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=9F=E3=81=93=E3=81=A8=E3=81=AB?= =?UTF-8?q?=E3=82=88=E3=82=8B=E6=94=B9=E4=BF=AE=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UserManagerAvatarController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Controller/UserManagerAvatarController.php b/Controller/UserManagerAvatarController.php index 6d52240..9ef010b 100644 --- a/Controller/UserManagerAvatarController.php +++ b/Controller/UserManagerAvatarController.php @@ -75,7 +75,7 @@ public function download() { //会員管理が使えない場合、NoImageを出力する $PluginsRole = $this->_getSimpleModel('PluginsRole'); $query = $this->_getQueryForPluginsRole(); - if (! $PluginsRole->find('count', $query)) { + if (! $PluginsRole->cacheFindQuery('count', $query)) { return $this->_downloadNoImage($User, $user); } @@ -127,6 +127,9 @@ protected function _getSimpleModel($modelName) { $Model->unbindModel($params); $Model->Behaviors->unload('Trackable'); + if ($modelName === 'PluginsRole') { + $Model->Behaviors->load('NetCommons.NetCommonsCache'); + } return $Model; } From ad7e0947430552fbacf99749152c99d760714dec Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 6 Jan 2019 21:51:45 +0900 Subject: [PATCH 04/31] =?UTF-8?q?phpunit=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 --- Test/Case/Controller/UserAddController/NotifyTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Test/Case/Controller/UserAddController/NotifyTest.php b/Test/Case/Controller/UserAddController/NotifyTest.php index 7d940d5..81c0d1b 100644 --- a/Test/Case/Controller/UserAddController/NotifyTest.php +++ b/Test/Case/Controller/UserAddController/NotifyTest.php @@ -27,6 +27,7 @@ class UserAddControllerNotifyTest extends NetCommonsControllerTestCase { public $fixtures = array( 'plugin.mails.mail_setting_fixed_phrase', 'plugin.user_attributes.user_attribute_layout', + 'plugin.user_attributes.plugins_role4test', ); /** From c054859d2173207b99a39927d9dc607fc498c1fb Mon Sep 17 00:00:00 2001 From: Mitsuru Mutaguchi Date: Fri, 15 Feb 2019 18:27:18 +0900 Subject: [PATCH 05/31] =?UTF-8?q?fix:=20=E4=BC=9A=E5=93=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E3=82=A8=E3=82=AF=E3=82=B9=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=80=81=E5=9F=BA=E6=9C=AC=E6=9D=A1=E4=BB=B6=E3=82=92?= =?UTF-8?q?=E4=BC=9A=E5=93=A1=E6=83=85=E5=A0=B1=E4=B8=80=E8=A6=A7=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=A8=E5=90=88=E3=82=8F=E3=81=9B=E3=82=8B=20https:?= =?UTF-8?q?//github.com/NetCommons3/NetCommons3/issues/1437?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UserManagerController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/UserManagerController.php b/Controller/UserManagerController.php index f191184..975b6bb 100644 --- a/Controller/UserManagerController.php +++ b/Controller/UserManagerController.php @@ -326,7 +326,7 @@ public function export() { $csvWriter = $this->User->exportUsers( array( 'conditions' => array( - 'space_id' => Space::PRIVATE_SPACE_ID, + 'space_id !=' => Space::PRIVATE_SPACE_ID, 'User.role_key NOT' => array( UserRole::USER_ROLE_KEY_SYSTEM_ADMINISTRATOR, UserRole::USER_ROLE_KEY_ADMINISTRATOR From 6fb3ef94190c850b4a61ce794f7d4e026b574051 Mon Sep 17 00:00:00 2001 From: Ryuji AMANO Date: Thu, 9 May 2019 11:22:50 +0900 Subject: [PATCH 06/31] =?UTF-8?q?change:=20beforeValidate()=E3=82=92?= =?UTF-8?q?=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=99=E3=81=9F=E3=81=B3=E3=81=AB?= =?UTF-8?q?Hash::merge=E3=81=A7=E3=83=90=E3=83=AA=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=AB=E3=83=BC=E3=83=AB=E3=81=8C?= =?UTF-8?q?=E5=A2=97=E3=81=88=E3=82=8B=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82?= =?UTF-8?q?=E3=82=8B=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82ValidateM?= =?UTF-8?q?erge::merge=E3=81=B8=E7=BD=AE=E3=81=8D=E6=8F=9B=E3=81=88?= =?UTF-8?q?=E3=81=9F=20Refs=20https://github.com/NetCommons3/NetCommons3/i?= =?UTF-8?q?ssues/1486?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/UserMail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/UserMail.php b/Model/UserMail.php index 8f2b34b..dfb736b 100644 --- a/Model/UserMail.php +++ b/Model/UserMail.php @@ -50,7 +50,7 @@ class UserMail extends UserManagerAppModel { * @see Model::save() */ public function beforeValidate($options = array()) { - $this->validate = Hash::merge($this->validate, array( + $this->validate = ValidateMerge::merge($this->validate, array( 'user_id' => array( 'notBlank' => array( 'rule' => array('notBlank'), From f6ba73ff3685acb8b5fc4725a0491a5e4b8701a9 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 4 Oct 2019 22:13:20 +0900 Subject: [PATCH 07/31] =?UTF-8?q?fix:=20test:=20UnitTest=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20https://github.com/NetCommons3/NetCommons3/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UserManagerAvatarController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Controller/UserManagerAvatarController.php b/Controller/UserManagerAvatarController.php index 9ef010b..a2b9cdf 100644 --- a/Controller/UserManagerAvatarController.php +++ b/Controller/UserManagerAvatarController.php @@ -117,7 +117,19 @@ protected function _downloadNoImage($User, $user) { protected function _getSimpleModel($modelName) { // TestでAvatarBehavior::temporaryAvatar をMock にしているため、removeObjectしない。 // ClassRegistry::removeObject($modelName); - $Model = ClassRegistry::init($modelName); + + //@codeCoverageIgnoreStart + if (empty($this->$modelName) || + substr(get_class($this->$modelName), 0, 5) !== 'Mock_') { + $Model = ClassRegistry::init($modelName); + } else { + $Model = $this->$modelName; + if (! ClassRegistry::getObject($modelName)) { + ClassRegistry::addObject($modelName, $Model); + } + } + //@codeCoverageIgnoreEnd + $params = [ 'belongsTo' => [ 'TrackableCreator', From 06c1e0b175160738f2369df0bf559e264d9b54c4 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 4 Oct 2019 22:24:56 +0900 Subject: [PATCH 08/31] =?UTF-8?q?fix:=20test:=20travis=20php7.2=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=20https://github.com/NetCommons3/NetCommons3/issues/1?= =?UTF-8?q?451?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 ++ phpunit.xml.dist | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dddd247..d6ed3e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,10 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 sudo: false +dist: trusty env: matrix: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 76c939f..3c20a75 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,6 +14,5 @@ - From a26396f1756f2b190ebda24787339313fc6ffda4 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 4 Oct 2019 22:45:10 +0900 Subject: [PATCH 09/31] =?UTF-8?q?fix:=20php7.2=E3=81=A7=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=20https://github.com/NetCommons3/NetCommons3/issues/1?= =?UTF-8?q?468?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UserAddController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Controller/UserAddController.php b/Controller/UserAddController.php index 23c56b7..f48f700 100644 --- a/Controller/UserAddController.php +++ b/Controller/UserAddController.php @@ -120,7 +120,8 @@ public function beforeFilter() { //メール通知の場合、NetCommonsMailUtilityをメンバー変数にセットする。Mockであれば、newをしない。 //テストでMockに差し替えが必要なための処理であるので、カバレッジレポートから除外する。 //@codeCoverageIgnoreStart - if ($this->params['action'] === 'notify' && substr(get_class($this->mail), 0, 4) !== 'Mock') { + if ($this->params['action'] === 'notify' && + (empty($this->mail) || substr(get_class($this->mail), 0, 4) !== 'Mock')) { $this->mail = new NetCommonsMail(); } //@codeCoverageIgnoreEnd From ece00d24913540474c0c6d83823f0174e103b9b9 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 5 Oct 2019 16:56:37 +0900 Subject: [PATCH 10/31] =?UTF-8?q?fix:=20test:=20UnitTest=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20https://github.com/NetCommons3/NetCommons3/issues/1468?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/UserAddController/BasicTest.php | 15 +++------------ .../UserAddController/BeforeFilterTest.php | 8 ++------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/Test/Case/Controller/UserAddController/BasicTest.php b/Test/Case/Controller/UserAddController/BasicTest.php index 1a1180d..c1b3066 100644 --- a/Test/Case/Controller/UserAddController/BasicTest.php +++ b/Test/Case/Controller/UserAddController/BasicTest.php @@ -86,13 +86,8 @@ public function testTmpAvatarDelete() { //ログイン TestAuthGeneral::login($this); - if (Configure::read('debug')) { - $exactly = 2; - } else { - $exactly = 1; - } $this->controller->Session - ->expects($this->exactly($exactly))->method('read') + ->expects($this->any())->method('read') ->will($this->returnCallback(function ($key) use ($avatarPath) { if ($key === 'UserAdd.User.avatar.tmp_name') { return $avatarPath; @@ -127,13 +122,9 @@ public function testReferer() { TestAuthGeneral::login($this); $data = $this->__data(); - if (Configure::read('debug')) { - $exactly = 2; - } else { - $exactly = 1; - } + $this->controller->Session - ->expects($this->exactly($exactly))->method('read') + ->expects($this->any())->method('read') ->will($this->returnCallback(function ($key) use ($data) { if ($key === 'UserAdd') { return $data; diff --git a/Test/Case/Controller/UserAddController/BeforeFilterTest.php b/Test/Case/Controller/UserAddController/BeforeFilterTest.php index ebf80aa..0e654a3 100644 --- a/Test/Case/Controller/UserAddController/BeforeFilterTest.php +++ b/Test/Case/Controller/UserAddController/BeforeFilterTest.php @@ -119,13 +119,9 @@ public function testNotify() { 'handlename' => '', 'username' => '', ); - if (Configure::read('debug')) { - $exactly = 2; - } else { - $exactly = 1; - } + $this->controller->Session - ->expects($this->exactly($exactly))->method('read') + ->expects($this->any())->method('read') ->will($this->returnCallback(function ($key) use ($user) { if ($key === 'UserAdd') { return array('User' => $user); From 5fd893f635e56a3b09c075cdad563d34fc8aa2b8 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 27 Dec 2019 12:51:41 +0900 Subject: [PATCH 11/31] =?UTF-8?q?fix:=20=E3=83=AA=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E5=8F=96=E5=BE=97=E3=81=AE=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UserManagerController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/UserManagerController.php b/Controller/UserManagerController.php index 975b6bb..38c5427 100644 --- a/Controller/UserManagerController.php +++ b/Controller/UserManagerController.php @@ -261,7 +261,7 @@ public function status() { ), 400); } - $this->redirect($this->request->referer()); + $this->redirect($this->request->referer(true)); } /** From 378c920a274149b97f1c844d06f1399f517f26f8 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 14 Mar 2020 15:29:36 +0900 Subject: [PATCH 12/31] =?UTF-8?q?change:=20test:=20travis.yml=E3=81=8B?= =?UTF-8?q?=E3=82=89php5.4,5.5=E3=82=92=E5=89=8A=E9=99=A4=E3=80=82php7.3,7?= =?UTF-8?q?.4=E3=82=92=E8=BF=BD=E5=8A=A0=20https://github.com/NetCommons3/?= =?UTF-8?q?NetCommons3/issues/1560?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d6ed3e5..038c3ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: php php: - - 5.4 - - 5.5 - 5.6 - 7.0 - 7.1 - 7.2 + - 7.3 + - 7.4 sudo: false dist: trusty From 55323fe61e8034919cd8161a6fc013e1fb7acaa1 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 8 Aug 2020 16:28:47 +0900 Subject: [PATCH 13/31] =?UTF-8?q?change:=20test:=20Travis=E3=81=8B?= =?UTF-8?q?=E3=82=89PHP5.6=E3=82=92=E5=89=8A=E9=99=A4,php72=E4=BB=A5?= =?UTF-8?q?=E9=99=8D=E3=81=A7UnitTest=E3=81=A7Warning=E3=81=8C=E5=87=BA?= =?UTF-8?q?=E3=82=8B=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://github.?= =?UTF-8?q?com/NetCommons3/NetCommons3/issues/1588?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 1 - phpunit.xml.dist | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 038c3ad..0763ed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.6 - 7.0 - 7.1 - 7.2 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3c20a75..20d49d5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,11 @@ + + + + + + app/Plugin/UserManager From dd53131800f559773fcbc331347625c7b0b9f68d Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 8 Aug 2020 21:58:02 +0900 Subject: [PATCH 14/31] =?UTF-8?q?change:=20test:=20phpunit=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E4=BF=AE=E6=AD=A3=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1588?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/Case/Controller/UserAddController/BasicTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/Case/Controller/UserAddController/BasicTest.php b/Test/Case/Controller/UserAddController/BasicTest.php index c1b3066..0e378f1 100644 --- a/Test/Case/Controller/UserAddController/BasicTest.php +++ b/Test/Case/Controller/UserAddController/BasicTest.php @@ -137,7 +137,7 @@ public function testReferer() { $this->_testGetAction(array('action' => 'basic'), array('method' => 'assertNotEmpty'), null, 'view'); //チェック - $this->assertEquals($this->controller->data, $this->__data()); + $this->__assertCreateUser(); $this->__assertInputs(); } From eed8147011eb62e701dd046be09d15b359d3be99 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 26 Aug 2020 20:23:01 +0900 Subject: [PATCH 15/31] change: Version number to 3.3.2 --- VERSION.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 VERSION.txt diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000..4772543 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +3.3.2 From b983572e306ce444f3a3f27f1c2425604a3ae9b9 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 13 Dec 2020 20:24:16 +0900 Subject: [PATCH 16/31] =?UTF-8?q?fix:=20test:=20TravisCI=E3=81=AEphp7.3?= =?UTF-8?q?=E3=81=A7=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=8C=E5=87=BA=E3=82=8B?= =?UTF-8?q?=E3=81=9F=E3=82=81=E4=BF=AE=E6=AD=A3=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1618?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0763ed9..a61180d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ php: - 7.0 - 7.1 - 7.2 - - 7.3 + - 7.3.24 - 7.4 sudo: false From 5ff03bce164c118c228ca1409a252f11360bf6a4 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 23 Jan 2021 14:08:22 +0900 Subject: [PATCH 17/31] =?UTF-8?q?add:=20release=E3=82=BF=E3=82=B0=E4=BB=98?= =?UTF-8?q?=E3=81=91=E3=81=AEgithub=20action=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/NetCommons3/NetCommons3/issues/1619 --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a3225bc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - '3*' + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: | + NetCommons ${{ github.ref }} released. + draft: false + prerelease: false From 6ea98627bdb4819215b99da71a64c8fe7fa364f5 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 23 Jan 2021 14:08:27 +0900 Subject: [PATCH 18/31] change: Version number to 3.3.3 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 4772543..619b537 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.2 +3.3.3 From 4316a03156c4a3a652434b98e207fd83c79dfe7f Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 2 Aug 2021 22:15:11 +0900 Subject: [PATCH 19/31] =?UTF-8?q?change:=20test:=20TravisCI=E3=81=8B?= =?UTF-8?q?=E3=82=89GithubAction=E3=81=AB=E5=A4=89=E6=9B=B4=20https://gith?= =?UTF-8?q?ub.com/NetCommons3/NetCommons3/issues/1650?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 137 ++++++++++++++++++++++++++++++++++++ .travis.yml | 42 ----------- README.md | 11 +-- phpunit.xml.dist | 4 +- 4 files changed, 141 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d6bd01e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,137 @@ +on: + push: + branches: + - main + - master + - availability + pull_request: + branches: + - main + - master + - availability + +name: tests + +jobs: + tests: + name: tests + runs-on: ubuntu-18.04 + strategy: + matrix: + php: [ '7.1', '7.2', '7.3', '7.4' ] + + env: + NC3_BUILD_DIR: "/opt/nc3" + NC3_DOCKER_DIR: "/opt/docker" + NC3_GIT_URL: "git://github.com/NetCommons3/NetCommons3.git" + NC3_GIT_BRANCH: "master" + PLUGIN_BUILD_DIR: ${{ github.workspace }} + PHP_VERSION: ${{ matrix.php }} + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: cakephp_test + + steps: + - uses: actions/checkout@v2 + + - name: environment + run: | + echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}" + echo "PLUGIN_BUILD_DIR=${PLUGIN_BUILD_DIR}" + echo "PHP_VERSION=${PHP_VERSION}" + ls -al ${PLUGIN_BUILD_DIR} + + - name: docker-compose install + run: | + curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose + chmod +x ~/docker-compose + sudo mv ~/docker-compose /usr/local/bin/docker-compose + docker-compose --version + + - name: git clone nc3 + run: git clone -b ${NC3_GIT_BRANCH} ${NC3_GIT_URL} ${NC3_BUILD_DIR} + + - name: git clone nc3_docker + run: git clone https://github.com/NetCommons3/nc3app-docker.git ${NC3_DOCKER_DIR} + + - name: docker-compose start + run: | + cd ${NC3_DOCKER_DIR} + docker-compose up -d + docker-compose start + + - run: docker ps + + - name: check libraries + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/start-on-docker.sh + + - name: nc3 build + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/app-build.sh + + - name: phpcs (PHP CodeSniffer) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpcs.sh + + - name: phpmd (PHP Mess Detector) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpmd.sh + + - name: phpcpd (PHP Copy/Paste Detector) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpcpd.sh + + - name: gjslint (JavaScript Style Check) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/gjslint.sh + + - name: phpdoc (PHP Documentor) + run: | + cd ${NC3_DOCKER_DIR} + docker-compose exec -T nc3app bash /opt/scripts/phpdoc.sh + + - name: phpunit (PHP UnitTest) + 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 + 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 + run: | + cd ${NC3_DOCKER_DIR} + docker-compose rm -f + + # テスト成功時はこちらのステップが実行される + - name: Slack Notification on Success + if: success() + uses: rtCamp/action-slack-notify@v2.2.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_CHANNEL: notify-netcommons3 + SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" + SLACK_COLOR: good + + # テスト失敗時はこちらのステップが実行される + - name: Slack Notification on Failure + uses: rtCamp/action-slack-notify@v2.2.0 + if: failure() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + SLACK_CHANNEL: notify-netcommons3 + SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" + SLACK_COLOR: danger diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a61180d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: php - -php: - - 7.0 - - 7.1 - - 7.2 - - 7.3.24 - - 7.4 - -sudo: false -dist: trusty - -env: - matrix: - - NETCOMMONS_VERSION=master DB=mysql - global: - - secure: "lpymvB/8q92fy5b52dCYUYvBuSLWORjqEGuHWKmEHXu6KbV1oMN0bp1BMryETafujZHscvaYgtho8gG5x+7EpucVU/ib1NWHeN3lrbDGrgwqTOVPnkEuBlzT2lUKw7ZwY4VtlScxmI8KRGj/larf1Ii5Tei4aNM7X4sWXO73AuZJBQLVgWP1E8DBtoHUcpaPPQPelr0q7HYUfaLakGpqzK4UXCtI8QASXV47C+3OUBJVLvl+PzNsMsAwHYPKj9as/OUwA5TgMiNXaWDyi4WolznJRHGK6ctM6XaVX7QPXbk3GfX1DpIJJIBioFKv4m3vQLmTRq76h4brZhe/OkY2q0a5q6MeNXS6VN7qopM+N160KTao98BseKaANwOyYxD9gPVFi2XXGvYlo0wbFh/Xj4by2UBuBIoyHJ9yR2wsAmohyCicHXOvPd0wZoJYx0y8Q3lg01vw+ZbOCAQtzURXIOxjUtQDlKYE6tuBnz4cEyAp0xFIVgDf1rHJ5fovMzu60345GU8/yBztaZnVlefp7Re4hBYggbdRy2s5VxmT66NVxSeHF4eOBsI73yq5fbUMmYDa13n/lZhJOzE/A49GEFnLhMAMbBpZtOHD7Opg/CdA64QrjO0CYcrpoflwhgc5UOGhuMiH0hO0BN+zXk01KmOHGe9XbX9EXjjUyBDrlUo=" - - GIT_COMMITTER_NAME=s-nakajima - - GIT_COMMITTER_EMAIL=nakajimashouhei@gmail.com - - GIT_AUTHOR_NAME=s-nakajima - - GIT_AUTHOR_EMAIL=nakajimashouhei@gmail.com - -before_script: - - export NETCOMMONS_BUILD_DIR=`dirname $TRAVIS_BUILD_DIR`/NetCommons3 - - git clone git://github.com/NetCommons3/NetCommons3 $NETCOMMONS_BUILD_DIR - - cd $NETCOMMONS_BUILD_DIR - - git checkout $NETCOMMONS_VERSION - - travis_wait . tools/build/plugins/cakephp/travis/pre.sh - - . tools/build/plugins/cakephp/travis/environment.sh - -script: - - . tools/build/plugins/cakephp/travis/main.sh - -after_script: - - . tools/build/plugins/cakephp/travis/post.sh - -notifications: - email: - recipients: - - netcommons3@googlegroups.com - on_success: never # default: change - on_failure: always # default: always diff --git a/README.md b/README.md index 015f7a9..b28b15b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,6 @@ UserManager ============== -UserManager for NetComomns3 - -[![Build Status](https://api.travis-ci.org/NetCommons3/UserManager.png?branch=master)](https://travis-ci.org/NetCommons3/UserManager) -[![Coverage Status](https://coveralls.io/repos/NetCommons3/UserManager/badge.png?branch=master)](https://coveralls.io/r/NetCommons3/UserManager?branch=master) - -| dependencies | status | -| ------------- | ------ | -| composer.json | [![Dependency Status](https://www.versioneye.com/user/projects/55cbc36bb7d70b000d000265/badge.png)](https://www.versioneye.com/user/projects/55cbc36bb7d70b000d000265) | +[![Tests Status](https://github.com/NetCommons3/UserManager/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/NetCommons3/UserManager/actions/workflows/tests.yml) +[![Coverage Status](https://coveralls.io/repos/NetCommons3/UserManager/badge.svg?branch=master)](https://coveralls.io/r/NetCommons3/UserManager?branch=master) +[![Stable Version](https://img.shields.io/packagist/v/netcommons/user-manager.svg?label=stable)](https://packagist.org/packages/netcommons/user-manager) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 20d49d5..447b7aa 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,9 +3,6 @@ - - - app/Plugin/UserManager @@ -20,5 +17,6 @@ + From d72f18a3052e4cc119aff6fa1f917f829c40a924 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Wed, 11 Aug 2021 17:37:17 +0900 Subject: [PATCH 20/31] =?UTF-8?q?change:=20test:=20Slack=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3,=20mysql8.0=E3=83=86=E3=82=B9=E3=83=88?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20https://github.com/NetCommons3/NetCommons3?= =?UTF-8?q?/issues/1650?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 35 +++++++++++++- .github/workflows/tests.yml | 47 ++++++++++++++----- .../UserAddController/UserRolesRoomsTest.php | 4 +- 3 files changed, 70 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a3225bc..592d72f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,16 +4,25 @@ on: tags: - '3*' -name: Create Release +name: create_release jobs: build: - name: Create Release + name: create_release runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 + - name: Slack Notification on Start + uses: rtCamp/action-slack-notify@v2.2.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }} + SLACK_CHANNEL: notify-nc3-release + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: "#f0ad4e" + SLACK_MESSAGE: "Start Job" + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -26,3 +35,25 @@ jobs: NetCommons ${{ github.ref }} released. draft: false prerelease: false + + # テスト成功時はこちらのステップが実行される + - name: Slack Notification on Finish + uses: rtCamp/action-slack-notify@v2.2.0 + if: success() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }} + SLACK_CHANNEL: notify-nc3-release + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: good + SLACK_MESSAGE: "Job Success" + + # テスト失敗時はこちらのステップが実行される + - name: Slack Notification on Failure + uses: rtCamp/action-slack-notify@v2.2.0 + if: failure() + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_RELEASE }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: danger + SLACK_MESSAGE: "Job Failure" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d6bd01e..1477ea2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,12 +13,26 @@ on: name: tests jobs: + setup: + name: setup + runs-on: ubuntu-18.04 + steps: + - name: Slack Notification on Start + uses: rtCamp/action-slack-notify@v2.2.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: "#f0ad4e" + tests: name: tests + needs: setup runs-on: ubuntu-18.04 strategy: matrix: php: [ '7.1', '7.2', '7.3', '7.4' ] + mysql: [ '5.7', '8.0' ] env: NC3_BUILD_DIR: "/opt/nc3" @@ -27,6 +41,7 @@ jobs: NC3_GIT_BRANCH: "master" PLUGIN_BUILD_DIR: ${{ github.workspace }} PHP_VERSION: ${{ matrix.php }} + MYSQL_VERSION: ${{ matrix.mysql }} MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: cakephp_test @@ -38,6 +53,7 @@ jobs: echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}" echo "PLUGIN_BUILD_DIR=${PLUGIN_BUILD_DIR}" echo "PHP_VERSION=${PHP_VERSION}" + echo "MYSQL_VERSION=${MYSQL_VERSION}" ls -al ${PLUGIN_BUILD_DIR} - name: docker-compose install @@ -116,22 +132,27 @@ jobs: cd ${NC3_DOCKER_DIR} docker-compose rm -f - # テスト成功時はこちらのステップが実行される - - name: Slack Notification on Success - if: success() - uses: rtCamp/action-slack-notify@v2.2.0 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: notify-netcommons3 - SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" - SLACK_COLOR: good - # テスト失敗時はこちらのステップが実行される - name: Slack Notification on Failure uses: rtCamp/action-slack-notify@v2.2.0 if: failure() env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - SLACK_CHANNEL: notify-netcommons3 - SLACK_TITLE: "${{ github.repository }}(${{ matrix.php }})" + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}(php${{ matrix.php }}, mysql${{ matrix.mysql }})" SLACK_COLOR: danger + + teardown: + name: teardown + runs-on: ubuntu-18.04 + needs: tests + steps: + # テスト成功時はこちらのステップが実行される + - name: Slack Notification on Success + if: success() + uses: rtCamp/action-slack-notify@v2.2.0 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_TESTS }} + SLACK_CHANNEL: notify-nc3-tests + SLACK_TITLE: "${{ github.repository }}" + SLACK_COLOR: good diff --git a/Test/Case/Controller/UserAddController/UserRolesRoomsTest.php b/Test/Case/Controller/UserAddController/UserRolesRoomsTest.php index a29faf5..97a6f9a 100644 --- a/Test/Case/Controller/UserAddController/UserRolesRoomsTest.php +++ b/Test/Case/Controller/UserAddController/UserRolesRoomsTest.php @@ -171,7 +171,9 @@ private function __assert() { $this->view = preg_replace('/[\s]+<', $this->view); $expected = array('2', '5', '11', '12'); - $this->assertEquals(array_keys($this->vars['rolesRooms']), $expected); + $actual = array_keys($this->vars['rolesRooms']); + sort($actual); + $this->assertEquals($actual, $expected); $expected = array('1', '2', '3', '4', '5'); $this->assertEquals($expected, Hash::extract($this->vars['rolesRooms'], '2.{s}.RolesRoom.id')); From 7eacd65f5c002352ff562e93df8e9d358ccbc973 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 13 Aug 2021 19:01:13 +0900 Subject: [PATCH 21/31] change: Version number to 3.3.4 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 619b537..a0891f5 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.3 +3.3.4 From ad545a94d1e5ae78b86808f8e23be33ce62f5c03 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Mon, 3 Jan 2022 15:20:40 +0900 Subject: [PATCH 22/31] =?UTF-8?q?change:=20=E4=BC=9A=E5=93=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=81=A7=E4=B8=80=E6=8B=AC=E5=89=8A=E9=99=A4=E6=A9=9F?= =?UTF-8?q?=E8=83=BD=E3=82=92=E8=BF=BD=E5=8A=A0=20https://github.com/NetCo?= =?UTF-8?q?mmons3/NetCommons3/issues/1676?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/UserManagerBulkComponent.php | 282 ++++++++++++++++++ Controller/UserManagerController.php | 41 ++- Lib/UserManagerSearchLib.php | 32 ++ Locale/eng/LC_MESSAGES/user_manager.po | 22 ++ Locale/jpn/LC_MESSAGES/user_manager.po | 22 ++ .../UserManagerController/IndexTest.php | 19 ++ View/UserManager/index.ctp | 160 ++++++++-- webroot/js/user_manager.js | 100 +++++++ 8 files changed, 651 insertions(+), 27 deletions(-) create mode 100644 Controller/Component/UserManagerBulkComponent.php create mode 100644 Lib/UserManagerSearchLib.php diff --git a/Controller/Component/UserManagerBulkComponent.php b/Controller/Component/UserManagerBulkComponent.php new file mode 100644 index 0000000..8fff260 --- /dev/null +++ b/Controller/Component/UserManagerBulkComponent.php @@ -0,0 +1,282 @@ + + * @author Shohei Nakajima + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +\App::uses('Component', 'Controller'); +\App::uses('UserSearchCompComponent', 'Users.Controller/Component'); +\App::uses('UserManagerSearchLib', 'UserManager.Lib'); +\App::uses('RoomsLibCommandExec', 'Rooms.Lib'); +\App::uses('UserAttributeChoice', 'UserAttributes.Model'); +\App::uses('RoomsLibCommandExec', 'Rooms.Lib'); + +/** + * UserManager Component + * + * @author Shohei Nakajima + * @package NetCommons\UserManager\Controller\Component + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class UserManagerBulkComponent extends Component { + +/** + * コントローラ + * + * @var UserManagerController|Controller + */ + public $controller; + +/** + * Userモデル + * + * @var User + */ + public $User; + +/** + * UserRoleSettingモデル + * + * @var UserRoleSetting + */ + public $UserRoleSetting; + +/** + * Called after the Controller::beforeFilter() and before the controller action + * + * @param Controller $controller Controller with components to startup + * @return void + */ + public function startup(Controller $controller) { + $this->controller = $controller; + $this->User = ClassRegistry::init('Users.User'); + $this->UserRoleSetting = ClassRegistry::init('UserRoles.UserRoleSetting'); + } + +/** + * 選択した会員を一括で利用不可に設定する + * + * @return CakeResponse|null + * @throws BadRequestException + */ + public function bulkNonactive() { + $controller = $this->controller; + $data = $controller->request->data['UserManagerBulk']; + + $displayIds = explode(',', $data['displayIds']); + $checkedIds = explode(',', $data['checkedIds']); + + //バリデーション + try { + if (! $this->__validateBulk($checkedIds, $displayIds)) { + //通常この条件に来ない。 + //ただし、jsonで処理された場合、当処理に入ってくるため、念のため抜けておく。 + return; + } + } catch (Exception $ex) { + throw $ex; + } + + //登録処理 + $users = $this->__findBulkUsers($checkedIds); + try { + //トランザクションBegin + $this->User->begin(); + + foreach ($users as $user) { + if (! UserManagerSearchLib::hasEditableBulkUser($user)) { + throw new BadRequestException(__d('net_commons', 'Bad Request')); + } + + //ステータス更新処理 + $this->User->updateStatus($user['User']['id'], \UserAttributeChoice::STATUS_CODE_NONACTIVE); + } + + //トランザクションCommit + $this->User->commit(); + } catch (Exception $ex) { + //トランザクションRollback + $this->User->rollback($ex); + } + + //リダイレクト + $controller->NetCommons->setFlashNotification( + __d('net_commons', 'Successfully saved.'), array('class' => 'success') + ); + return $controller->redirect($controller->referer('/user_manager/user_manager/index/')); + } + +/** + * 選択した会員を一括で削除する + * + * @return CakeResponse|null + * @throws BadRequestException + * @throws InternalErrorException + */ + public function bulkDelete() { + $controller = $this->controller; + $data = $controller->request->data['UserManagerBulk']; + + $displayIds = explode(',', $data['displayIds']); + $checkedIds = explode(',', $data['checkedIds']); + + //バリデーション + if (! $this->__validateBulk($checkedIds, $displayIds)) { + //通常この条件に来ない。 + //ただし、jsonで処理された場合、当処理に入ってくるため、念のため抜けておく。 + return; + } + + //削除処理 + $users = $this->__findBulkUsers($checkedIds); + try { + //トランザクションBegin + $this->User->begin(); + + foreach ($users as $user) { + if (! UserManagerSearchLib::hasEditableBulkUser($user)) { + throw new BadRequestException(__d('net_commons', 'Bad Request')); + } + + //削除処理 + if (! $this->User->deleteUser($user, false)) { + //本来あり得ないが、この処理に入ってきたら、エラーログに出力して、 + //throwを投げる + $error = [ + 'user' => $user, + 'validationErrors' => $this->User->validationErrors, + ]; + \CakeLog::error(__METHOD__ . '(' . __LINE__ . ') ' . var_export($error, true)); + throw new InternalErrorException(__d('net_commons', 'Internal Server Error')); + } + } + + //トランザクションCommit + $this->User->commit(); + + //全てが削除されたら、シェルを起動 + RoomsLibCommandExec::deleteRelatedRooms(); + } catch (Exception $ex) { + //トランザクションRollback + $this->User->rollback($ex); + } + + //リダイレクト + $controller->NetCommons->setFlashNotification( + __d('net_commons', 'Successfully deleted.'), array('class' => 'success') + ); + + return $controller->redirect($this->__makeDeleteRedirectUrl($data)); + } + +/** + * 一括削除のリダイレクトURLを生成する + * + * @param array $data リクエストデータ + * @return string + */ + private function __makeDeleteRedirectUrl($data) { + $controller = $this->controller; + + $referer = $controller->referer('/user_manager/user_manager/index/'); + $hasPrev = $data['hasPrev'] ?? false; + $hasNext = $data['hasNext'] ?? false; + $hasAdminUser = $data['hasAdminUser'] ?? false; + if (! $hasPrev || + $hasNext || + $hasAdminUser || + $data['displayIds'] !== $data['checkedIds']) { + //先頭ページか、最終ページではない、全選択されていない場合 + return $referer; + } else { + //先頭ページではなく、最終ページで、全選択されている場合 + $urlPath = parse_url($referer, PHP_URL_PATH); + if (! $urlPath) { + $urlPath = $referer; + } + $match = []; + if (preg_match('#/page:([0-9]+)#iu', $urlPath, $match)) { + $urlPath = preg_replace('#/page:([0-9]+)#iu', '', $urlPath); + if (substr($urlPath, -1) !== '/') { + $urlPath .= '/'; + } + $urlPath .= 'page:' . ((int)$match[1] - 1); + } + + $urlQuery = parse_url($referer, PHP_URL_QUERY); + return $urlPath . ($urlQuery ? '?' . $urlQuery : ''); + } + } + +/** + * 選択した会員を一括処理できるかどうかチェックする + * + * @param array $checkedIds チェックしているユーザIDリスト + * @param array $displayIds 画面に表示しているユーザIDリスト + * + * @return bool + */ + private function __validateBulk($checkedIds, $displayIds) { + if (count(array_diff($checkedIds, $displayIds)) > 0) { + $this->controller->throwBadRequest(); + return false; + } + + $count = $this->User->find('count', [ + 'recursive' => -1, + 'conditions' => [ + 'id' => $checkedIds + ], + ]); + if ($count !== count($checkedIds)) { + $this->controller->throwBadRequest(); + return false; + } + + return true; + } + +/** + * 一括処理するユーザを取得 + * + * @param array $checkedIds チェックしているユーザIDリスト + * + * @return array + */ + private function __findBulkUsers($checkedIds) { + $users = $this->User->find('all', [ + 'recursive' => -1, + 'fields' => [ + $this->User->alias . '.id', + $this->User->alias . '.handlename', + $this->User->alias . '.role_key', + $this->UserRoleSetting->alias . '.origin_role_key', + ], + 'conditions' => [ + $this->User->alias . '.id' => $checkedIds, + ], + 'joins' => [ + [ + 'table' => $this->UserRoleSetting->table, + 'alias' => $this->UserRoleSetting->alias, + 'type' => 'INNER', + 'conditions' => [ + $this->User->alias . '.role_key' . ' = ' . $this->UserRoleSetting->alias . '.role_key' + ], + ] + ] + ]); + if (empty($users)) { + $this->controller->throwBadRequest(); + return false; + } + + return $users; + } + +} diff --git a/Controller/UserManagerController.php b/Controller/UserManagerController.php index 38c5427..eb91096 100644 --- a/Controller/UserManagerController.php +++ b/Controller/UserManagerController.php @@ -17,6 +17,19 @@ /** * UserManager Controller * + * @property AutoUserRegist $AutoUserRegist + * @property AutoUserRegistMail $AutoUserRegistMail + * @property User $User + * @property UserSearch $UserSearch + * @property DownloadComponent $Download + * @property FileUploadComponent $FileUpload + * @property SwitchLanguageComponent $SwitchLanguage + * @property RoomsComponent $Rooms + * @property UserAttributeLayoutComponent $UserAttributeLayout + * @property UserManagerComponent $UserManager + * @property UserManagerBulkComponent $UserManagerBulk + * @property UserSearchCompComponent $UserSearchComp + * * @author Shohei Nakajima * @package NetCommons\UserManager\Controller * @SuppressWarnings(PHPMD.TooManyPublicMethods) @@ -62,6 +75,7 @@ class UserManagerController extends UserManagerAppController { 'Rooms.Rooms', 'UserAttributes.UserAttributeLayout', 'UserManager.UserManager', + 'UserManager.UserManagerBulk', 'Users.UserSearchComp', ); @@ -86,7 +100,8 @@ public function index() { //ユーザ一覧データ取得 $this->UserSearchComp->search([ - 'fields' => self::$displaFields, + 'fields' => array_merge(['origin_role_key'], self::$displaFields), + 'displayFields' => self::$displaFields, 'conditions' => array('space_id !=' => Space::PRIVATE_SPACE_ID), 'joins' => array('Room' => array( 'conditions' => array( @@ -360,4 +375,28 @@ public function export() { } } +/** + * bulkアクション + * + * @return void + */ + public function bulk() { + //タイムアウト発生するなら適宜設定 + set_time_limit(1800); + if (! $this->request->is('post')) { + return $this->throwBadRequest(); + } + + if ($this->request->data['UserManagerBulk']['submit'] === 'nonactive') { + //利用不可に設定 + return $this->UserManagerBulk->bulkNonactive(); + } elseif ($this->request->data['UserManagerBulk']['submit'] === 'delete') { + //削除する + return $this->UserManagerBulk->bulkDelete(); + } else { + //それ以外 + return $this->throwBadRequest(); + } + } + } diff --git a/Lib/UserManagerSearchLib.php b/Lib/UserManagerSearchLib.php new file mode 100644 index 0000000..5fb8c9d --- /dev/null +++ b/Lib/UserManagerSearchLib.php @@ -0,0 +1,32 @@ + + * @author Shohei Nakajima + * @link http://www.netcommons.org NetCommons Project + * @license http://www.netcommons.org/license.txt NetCommons License + * @copyright Copyright 2014, NetCommons Project + */ + +\App::uses('UserRole', 'UserRoles.Model'); + +/** + * 会員管理の一覧に関するライブラリ + * + * @package NetCommons\UserManager\Lib + */ +class UserManagerSearchLib { + +/** + * 一括操作できるユーザかどうか + * + * @param array $user ユーザデータ + * @return bool + */ + public static function hasEditableBulkUser($user) { + $roleKey = $user['UserRoleSetting']['origin_role_key'] ?? null; + return ! in_array($roleKey, \UserRole::$systemRoles, true); + } + +} diff --git a/Locale/eng/LC_MESSAGES/user_manager.po b/Locale/eng/LC_MESSAGES/user_manager.po index cc1b7aa..91fe256 100644 --- a/Locale/eng/LC_MESSAGES/user_manager.po +++ b/Locale/eng/LC_MESSAGES/user_manager.po @@ -291,6 +291,28 @@ msgstr "" msgid "Do you approve?" msgstr "" + +msgid "Delete" +msgstr "" + +msgid "Change to nonactive" +msgstr "" + +msgid "Selected row ..." +msgstr "" + +msgid "Selected members" +msgstr "" + +msgid "Is it really okay to delete it?" +msgstr "" + +msgid "Nonactive the %s. Are you sure to proceed?" +msgstr "" + +msgid "Not found the select user." +msgstr "" + #: Users/View/Helper/UserSearchHelper.php:267 msgid "Approval" msgstr "" diff --git a/Locale/jpn/LC_MESSAGES/user_manager.po b/Locale/jpn/LC_MESSAGES/user_manager.po index adef55d..fe78cf4 100644 --- a/Locale/jpn/LC_MESSAGES/user_manager.po +++ b/Locale/jpn/LC_MESSAGES/user_manager.po @@ -79,6 +79,28 @@ msgid "Do you approve?" msgstr "承認しますか。" +msgid "Delete" +msgstr "削除する" + +msgid "Change to nonactive" +msgstr "利用不可にする" + +msgid "Selected row ..." +msgstr "選択した行を・・・" + +msgid "Selected members" +msgstr "選択した会員" + +msgid "Is it really okay to delete it?" +msgstr "削除すると元に戻すことは出来ません。本当に削除して良いですか。" + +msgid "Nonactive the %s. Are you sure to proceed?" +msgstr "%sを利用不可に設定します。本当によろしいですか。" + +msgid "Not found the select user." +msgstr "一つも選択されていません。" + + # # 入力画面 # diff --git a/Test/Case/Controller/UserManagerController/IndexTest.php b/Test/Case/Controller/UserManagerController/IndexTest.php index b28ce5e..1b261ff 100644 --- a/Test/Case/Controller/UserManagerController/IndexTest.php +++ b/Test/Case/Controller/UserManagerController/IndexTest.php @@ -54,6 +54,7 @@ public function tearDown() { * index()アクションのGetリクエストテスト * * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function testIndexGet() { //テスト実行 @@ -85,6 +86,9 @@ public function testIndexGet() { 'modified' => '2015-08-15 06:12:30', 'last_login' => '2016-09-14 12:18:45', ), + 'UserRoleSetting' => [ + 'origin_role_key' => 'system_administrator' + ], 'UsersLanguage' => array( 'name' => 'System Administrator Name', ), @@ -96,6 +100,9 @@ public function testIndexGet() { 'modified' => '2015-08-15 06:12:30', 'last_login' => null, ), + 'UserRoleSetting' => [ + 'origin_role_key' => 'administrator' + ], 'UsersLanguage' => array( 'name' => 'Site Manager Name', ), @@ -107,6 +114,9 @@ public function testIndexGet() { 'modified' => '2015-08-15 06:12:30', 'last_login' => null, ), + 'UserRoleSetting' => [ + 'origin_role_key' => 'common_user' + ], 'UsersLanguage' => array( 'name' => 'Chief Editor Name', ), @@ -118,6 +128,9 @@ public function testIndexGet() { 'modified' => '2015-08-15 06:12:30', 'last_login' => null, ), + 'UserRoleSetting' => [ + 'origin_role_key' => 'common_user' + ], 'UsersLanguage' => array( 'name' => 'Editor Name', ), @@ -129,6 +142,9 @@ public function testIndexGet() { 'modified' => '2015-08-15 06:12:30', 'last_login' => null, ), + 'UserRoleSetting' => [ + 'origin_role_key' => 'common_user' + ], 'UsersLanguage' => array( 'name' => 'General User Name', ), @@ -140,6 +156,9 @@ public function testIndexGet() { 'modified' => '2015-08-15 06:12:30', 'last_login' => null, ), + 'UserRoleSetting' => [ + 'origin_role_key' => 'common_user' + ], 'UsersLanguage' => array( 'name' => 'Visitor Name', ), diff --git a/View/UserManager/index.ctp b/View/UserManager/index.ctp index 0f46547..41662d2 100644 --- a/View/UserManager/index.ctp +++ b/View/UserManager/index.ctp @@ -9,6 +9,8 @@ * @copyright Copyright 2014, NetCommons Project */ +\App::uses('UserManagerSearchLib', 'UserManager.Lib'); + echo $this->NetCommonsHtml->css(array( '/user_manager/css/style.css', '/users/css/style.css', @@ -39,34 +41,140 @@ echo $this->NetCommonsHtml->script('/user_manager/js/user_manager.js'); end(); ?> -MessageFlash->description( - __d('user_manager', 'Click the handle name to read his/her data. And to edit the user data. And delete user data, please go from editing screen.') -); ?> +
+ MessageFlash->description( + __d('user_manager', 'Click the handle name to read his/her data. And to edit the user data. And delete user data, please go from editing screen.') + ); ?> + +
+ UserSearchForm->displaySearchButton(__d('user_manager', 'Search for the members'), [], true); ?> + + Paginator->counter('{:count}') > 0) : ?> +
+ + + -
- UserSearchForm->displaySearchButton(__d('user_manager', 'Search for the members'), [], true); ?> + + +
+ -
- Button->addLink(__d('user_manager', 'Add user'), ['controller' => 'user_add', 'action' => 'basic']); ?> +
+ Button->addLink(__d('user_manager', 'Add user'), ['controller' => 'user_add', 'action' => 'basic']); ?> +
-
- -
- - - - UserSearch->tableHeaders(true); ?> - - - - - $user) : ?> - UserSearch->userActiveClass($user); ?>> - UserSearch->tableRow($user, true, ['controller' => 'user_manager', 'action' => 'edit']); ?> + +
+ + +
+ + + + UserSearch->tableHeaders(true); ?> - - -
+ +
-
+ + + + $user) : ?> + NetCommonsForm->domId('User.id.' . $user['User']['id']); + ?> + UserSearch->userActiveClass($user); ?>> + + '; + echo ''; + echo ''; + $bulkUserIds[] = $user['User']['id']; + } else { + $hasAdminUser = true; + } + ?> + + UserSearch->tableRow($user, true, ['controller' => 'user_manager', 'action' => 'edit']); ?> + + + + + NetCommonsForm->create('UserManagerBulk', [ + 'url' => NetCommonsUrl::actionUrlAsArray(['controller' => 'user_manager', 'action' => 'bulk']) + ]); + echo $this->NetCommonsForm->hidden('UserManagerBulk.displayIds', ['value' => implode(',', $bulkUserIds)]); + echo $this->NetCommonsForm->hidden('UserManagerBulk.hasPrev', ['value' => $this->Paginator->hasPrev()]); + echo $this->NetCommonsForm->hidden('UserManagerBulk.hasNext', ['value' => $this->Paginator->hasNext()]); + echo $this->NetCommonsForm->hidden('UserManagerBulk.hasAdminUser', ['value' => $hasAdminUser]); + + echo $this->NetCommonsForm->unlockField('UserManagerBulk.checkedIds'); + echo $this->NetCommonsForm->hidden('UserManagerBulk.checkedIds', ['value' => '']); + + echo $this->NetCommonsForm->unlockField('UserManagerBulk.submit'); + echo $this->NetCommonsForm->hidden('UserManagerBulk.submit', ['value' => '']); + + echo $this->NetCommonsForm->end(); + ?> +
-element('NetCommons.paginator'); + element('NetCommons.paginator'); ?> +
\ No newline at end of file diff --git a/webroot/js/user_manager.js b/webroot/js/user_manager.js index bdec69f..1cf9eda 100644 --- a/webroot/js/user_manager.js +++ b/webroot/js/user_manager.js @@ -10,6 +10,106 @@ NetCommonsApp.controller('UserManagerController', ['$scope', 'NetCommonsModal', 'NC3_URL', function($scope, NetCommonsModal, NC3_URL) { + /** + * 選択したIDリスト + */ + $scope.checkedIds = []; + + /** + * チェックボックスの全選択・全解除 + */ + $scope.allCheck = function($event) { + var elements = $('input[type="checkbox"]'); + + for (var i = 0; i < elements.length; i++) { + if (elements[i].name) { + $scope._changeCheck(elements[i], $event.currentTarget.checked); + } + } + }; + + /** + * チェックボックスクリック + */ + $scope.check = function($event) { + $scope._changeCheck($event.currentTarget, $event.currentTarget.checked); + }; + + /** + * チェックボックス変更処理 + */ + $scope._changeCheck = function(element, checked) { + var id = element.value; + var domId = element.id; + element.checked = checked; + $scope.checkedIds[id] = checked; + + var trElement = $('#Tr' + domId); + + if (checked) { + if (trElement.hasClass('warning')) { + trElement.removeClass('warning'); + trElement.addClass('_warning'); + } else if (trElement.hasClass('danger')) { + trElement.removeClass('danger'); + trElement.addClass('_danger'); + } + + if (! trElement.hasClass('success')) { + trElement.addClass('success'); + } + } else { + if (trElement.hasClass('_warning')) { + trElement.removeClass('_warning'); + trElement.addClass('warning'); + } else if (trElement.hasClass('_danger')) { + trElement.removeClass('_danger'); + trElement.addClass('danger'); + } + + if (trElement.hasClass('success')) { + trElement.removeClass('success'); + } + } + }; + + /** + * 一括登録処理 + */ + $scope.bulk = function($event, action, firstMessage, secondMessage, notSelectMessage) { + var checkedIds = []; + angular.forEach($scope.checkedIds, function(checked, id) { + if (checked) { + checkedIds.push(id); + } + }, checkedIds); + if (! checkedIds.length) { + alert(notSelectMessage); + $event.preventDefault(); + return; + } + + if (! confirm(firstMessage)) { + $event.preventDefault(); + return; + } + + if (secondMessage && ! confirm(secondMessage)) { + $event.preventDefault(); + return; + } + + var checkedElement = $('#UserManagerBulkCheckedIds'); + checkedElement[0].value = checkedIds.join(','); + + var submitElement = $('#UserManagerBulkSubmit'); + submitElement[0].value = action; + + $scope.sending = true; + var formElement = $('#UserManagerBulkBulkForm'); + formElement.submit(); + }; + /** * 検索ダイアログ表示 * From ef8cdaf6b7b5ed496a6ad11e444af0f1892734af Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 11 Feb 2022 22:55:04 +0900 Subject: [PATCH 23/31] change: Version number to 3.3.5 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index a0891f5..fa7adc7 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -3.3.4 +3.3.5 From 918dc119da25f10b924a2915d2e0f187ecf2ad9e Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 24 Feb 2023 17:14:40 +0900 Subject: [PATCH 24/31] =?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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1477ea2..7cfa881 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,10 +44,14 @@ jobs: MYSQL_VERSION: ${{ matrix.mysql }} MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: cakephp_test + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 + - name: Fix up git URLs + run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig + - name: environment run: | echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}" @@ -58,7 +62,7 @@ jobs: - name: docker-compose install run: | - curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose + curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose chmod +x ~/docker-compose sudo mv ~/docker-compose /usr/local/bin/docker-compose docker-compose --version From 416fca74cd996f101e6f39768164a45004c64c57 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sun, 26 Feb 2023 07:48:38 +0900 Subject: [PATCH 25/31] 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 2fed376a8975abcb99ab195df937f3e4c3042050 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 2 Jun 2023 08:53:55 +0900 Subject: [PATCH 26/31] =?UTF-8?q?fix:=20WYSIWYG=E3=81=AE=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E5=87=A6=E7=90=86=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UserManagerAvatarController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/UserManagerAvatarController.php b/Controller/UserManagerAvatarController.php index a2b9cdf..5331170 100644 --- a/Controller/UserManagerAvatarController.php +++ b/Controller/UserManagerAvatarController.php @@ -83,7 +83,7 @@ public function download() { 'size' => $this->params['size'], ]; - return $this->Download->doDownloadByUploadFileId($user['UploadFile']['id'], $options); + return $this->Download->doDownloadByUploadFileId($user['UploadFile']['id'], $options, 'users'); } /** From ebf87f1ee69864174e4d9f691b3ece8bc275d834 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 2 Jun 2023 08:55:00 +0900 Subject: [PATCH 27/31] =?UTF-8?q?test:=20GithubAction=E3=81=AE=E3=82=A8?= =?UTF-8?q?=E3=83=A9=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 | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7cfa881..bfe7e70 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' ] @@ -92,46 +92,54 @@ 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 - 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 +# 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: docker-compose remove + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose rm -f @@ -148,7 +156,7 @@ jobs: teardown: name: teardown - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: tests steps: # テスト成功時はこちらのステップが実行される From 144bed436ec14dad2a1b9a836410efc6a0289b37 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Tue, 8 Aug 2023 11:21:43 +0900 Subject: [PATCH 28/31] =?UTF-8?q?fix:=20NC3=E4=BC=9A=E5=93=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=82=A2=E3=83=90=E3=82=BF=E3=83=BC=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=81=AE=E4=B8=8D=E5=85=B7=E5=90=88=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/routes.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Config/routes.php b/Config/routes.php index ceac0bf..643847e 100644 --- a/Config/routes.php +++ b/Config/routes.php @@ -27,7 +27,7 @@ Router::connect( '/user_manager/user_manager/download/:user_id/:field_name/:size', ['plugin' => 'user_manager', 'controller' => 'user_manager_avatar', 'action' => 'download'], - ['user_id' => '[0-9]+', 'size' => 'big|medium|small|thumb'] + ['user_id' => '[0-9]+', 'field_name' => 'avatar', 'size' => 'big|medium|small|thumb'] ); Router::connect( '/user_manager/user_manager/download/:user_id/:field_name', @@ -37,7 +37,13 @@ 'action' => 'download', 'size' => 'medium' ], - ['user_id' => '[0-9]+', 'size' => 'medium'] + ['user_id' => '[0-9]+', 'field_name' => 'avatar', 'size' => 'medium'] +); +Router::connect( + '/user_manager/user_manager/download/*', + array( + 'plugin' => 'user_manager', 'controller' => 'user_manager', 'action' => 'throwBadRequest', + ) ); Router::connect( From 3dbb466d195e5ce9b0669ceda9cb78b499324621 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Tue, 8 Aug 2023 11:26:21 +0900 Subject: [PATCH 29/31] =?UTF-8?q?test:=20GithubActions=E3=81=AE=E3=82=A8?= =?UTF-8?q?=E3=83=A9=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 | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1477ea2..bfe7e70 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' ] @@ -44,10 +44,14 @@ jobs: MYSQL_VERSION: ${{ matrix.mysql }} MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: cakephp_test + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 + - name: Fix up git URLs + run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig + - name: environment run: | echo "GITHUB_WORKSPACE=${GITHUB_WORKSPACE}" @@ -58,7 +62,7 @@ jobs: - name: docker-compose install run: | - curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose + curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > ~/docker-compose chmod +x ~/docker-compose sudo mv ~/docker-compose /usr/local/bin/docker-compose docker-compose --version @@ -88,46 +92,54 @@ 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 - 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 +# 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: docker-compose remove + if: always() run: | cd ${NC3_DOCKER_DIR} docker-compose rm -f @@ -144,7 +156,7 @@ jobs: teardown: name: teardown - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: tests steps: # テスト成功時はこちらのステップが実行される From 2b81ef5420a1086487a9a191c5b856415d8a64cf Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Fri, 6 Oct 2023 12:40:37 +0900 Subject: [PATCH 30/31] =?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 bfe7e70..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 2c3543319cf6de0f1dbe55b068016d8cadae570d Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Tue, 10 Oct 2023 00:45:50 +0900 Subject: [PATCH 31/31] 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