From 39e9d866bfb1ee7198fa6580118c9074ea512bf4 Mon Sep 17 00:00:00 2001 From: Luciano Righetti Date: Wed, 2 Mar 2022 16:32:06 +0100 Subject: [PATCH] fix: warnings, notices, deprecation errors --- .../default/InboxProcessors/LocalToolInboxProcessor.php | 4 ++-- libraries/default/InboxProcessors/UserInboxProcessor.php | 6 +++--- src/Controller/SharingGroupsController.php | 1 + tests/Helper/ApiTestTrait.php | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/default/InboxProcessors/LocalToolInboxProcessor.php b/libraries/default/InboxProcessors/LocalToolInboxProcessor.php index 8852f9e..2dacab8 100644 --- a/libraries/default/InboxProcessors/LocalToolInboxProcessor.php +++ b/libraries/default/InboxProcessors/LocalToolInboxProcessor.php @@ -159,9 +159,9 @@ class LocalToolInboxProcessor extends GenericInboxProcessor { return $validator ->requirePresence('connectorName') - ->notEmpty('connectorName', 'The connector name must be provided') + ->notEmptyString('connectorName', 'The connector name must be provided') ->requirePresence('cerebrateURL') - ->notEmpty('cerebrateURL', 'A url must be provided') + ->notEmptyString('cerebrateURL', 'A url must be provided') ->requirePresence('local_tool_id') ->numeric('local_tool_id', 'A local_tool_id must be provided') ->requirePresence('remote_tool_id') diff --git a/libraries/default/InboxProcessors/UserInboxProcessor.php b/libraries/default/InboxProcessors/UserInboxProcessor.php index 53312d5..abb9550 100644 --- a/libraries/default/InboxProcessors/UserInboxProcessor.php +++ b/libraries/default/InboxProcessors/UserInboxProcessor.php @@ -37,13 +37,13 @@ class RegistrationProcessor extends UserInboxProcessor implements GenericInboxPr protected function addValidatorRules($validator) { return $validator - ->notEmpty('username', 'A username must be provided.') + ->notEmptyString('username', 'A username must be provided.') ->add('email', 'validFormat', [ 'rule' => 'email', 'message' => 'E-mail must be valid' ]) - ->notEmpty('first_name', 'A first name must be provided') - ->notEmpty('last_name', 'A last name must be provided') + ->notEmptyString('first_name', 'A first name must be provided') + ->notEmptyString('last_name', 'A last name must be provided') ->add('password', 'password_complexity', [ 'rule' => function($value, $context) { if (!preg_match('/^((?=.*\d)|(?=.*\W+))(?![\n])(?=.*[A-Z])(?=.*[a-z]).*$|.{16,}/s', $value) || strlen($value) < 12) { diff --git a/src/Controller/SharingGroupsController.php b/src/Controller/SharingGroupsController.php index e03aee5..41a4c66 100644 --- a/src/Controller/SharingGroupsController.php +++ b/src/Controller/SharingGroupsController.php @@ -113,6 +113,7 @@ class SharingGroupsController extends AppController public function delete($id) { $currentUser = $this->ACL->getUser(); + $params = []; if (empty($currentUser['role']['perm_admin'])) { $params['conditions'] = ['organisation_id' => $currentUser['organisation_id']]; } diff --git a/tests/Helper/ApiTestTrait.php b/tests/Helper/ApiTestTrait.php index 4b3986f..3e71622 100644 --- a/tests/Helper/ApiTestTrait.php +++ b/tests/Helper/ApiTestTrait.php @@ -56,6 +56,7 @@ trait ApiTestTrait // somehow this is not set automatically in test environment $_SERVER['HTTP_AUTHORIZATION'] = $authToken; + $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; $this->configRequest([ 'headers' => [