fix: warnings, notices, deprecation errors

pull/92/head
Luciano Righetti 2022-03-02 16:32:06 +01:00
parent d577d11703
commit 39e9d866bf
4 changed files with 7 additions and 5 deletions

View File

@ -159,9 +159,9 @@ class LocalToolInboxProcessor extends GenericInboxProcessor
{ {
return $validator return $validator
->requirePresence('connectorName') ->requirePresence('connectorName')
->notEmpty('connectorName', 'The connector name must be provided') ->notEmptyString('connectorName', 'The connector name must be provided')
->requirePresence('cerebrateURL') ->requirePresence('cerebrateURL')
->notEmpty('cerebrateURL', 'A url must be provided') ->notEmptyString('cerebrateURL', 'A url must be provided')
->requirePresence('local_tool_id') ->requirePresence('local_tool_id')
->numeric('local_tool_id', 'A local_tool_id must be provided') ->numeric('local_tool_id', 'A local_tool_id must be provided')
->requirePresence('remote_tool_id') ->requirePresence('remote_tool_id')

View File

@ -37,13 +37,13 @@ class RegistrationProcessor extends UserInboxProcessor implements GenericInboxPr
protected function addValidatorRules($validator) protected function addValidatorRules($validator)
{ {
return $validator return $validator
->notEmpty('username', 'A username must be provided.') ->notEmptyString('username', 'A username must be provided.')
->add('email', 'validFormat', [ ->add('email', 'validFormat', [
'rule' => 'email', 'rule' => 'email',
'message' => 'E-mail must be valid' 'message' => 'E-mail must be valid'
]) ])
->notEmpty('first_name', 'A first name must be provided') ->notEmptyString('first_name', 'A first name must be provided')
->notEmpty('last_name', 'A last name must be provided') ->notEmptyString('last_name', 'A last name must be provided')
->add('password', 'password_complexity', [ ->add('password', 'password_complexity', [
'rule' => function($value, $context) { 'rule' => function($value, $context) {
if (!preg_match('/^((?=.*\d)|(?=.*\W+))(?![\n])(?=.*[A-Z])(?=.*[a-z]).*$|.{16,}/s', $value) || strlen($value) < 12) { if (!preg_match('/^((?=.*\d)|(?=.*\W+))(?![\n])(?=.*[A-Z])(?=.*[a-z]).*$|.{16,}/s', $value) || strlen($value) < 12) {

View File

@ -113,6 +113,7 @@ class SharingGroupsController extends AppController
public function delete($id) public function delete($id)
{ {
$currentUser = $this->ACL->getUser(); $currentUser = $this->ACL->getUser();
$params = [];
if (empty($currentUser['role']['perm_admin'])) { if (empty($currentUser['role']['perm_admin'])) {
$params['conditions'] = ['organisation_id' => $currentUser['organisation_id']]; $params['conditions'] = ['organisation_id' => $currentUser['organisation_id']];
} }

View File

@ -56,6 +56,7 @@ trait ApiTestTrait
// somehow this is not set automatically in test environment // somehow this is not set automatically in test environment
$_SERVER['HTTP_AUTHORIZATION'] = $authToken; $_SERVER['HTTP_AUTHORIZATION'] = $authToken;
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$this->configRequest([ $this->configRequest([
'headers' => [ 'headers' => [