Skip to content

Admin field not syncronized #22

Description

@guppy42

Short description

The admin field is completely ignored by clients and while logins work all the user have access to is the logout button.
Not sure why this issue hasn't cropped up before I suspect it may be down to mysql version or driver.

Setup:

Server:

TYPO3 Version		12.4.10
Webserver		Apache
PHP Version		8.2.15
Database (Default)	MySQL 8.0.35-27 / pdo_mysql
Application Context	Production
Operating System	Linux 5.14.0-362.13.1.el9_3.x86_64
T3AM			5.0.0 (default.isServer=1)

Client:

TYPO3 Version		12.4.10
Webserver		Apache
PHP Version		8.2.15
Database (Default)	MySQL 8.0.35-27 / pdo_mysql
Application Context	Production
Operating System	Linux 5.14.0-362.13.1.el9_3.x86_64
Bootstrap Package	14.0.7
T3AM			5.0.0 

Problem location

In the function:
typo3conf/ext/t3am/Classes/Domain/Factory/UserFactory.php :: toDatabaseConformArray

The database columns are compared to the JSON keys of the user object.

This works for every field except admin due to it's array key being stored escaped:

var_dump($columns):

array(31) {
 ....
["avatar"]=>
  object(Doctrine\DBAL\Schema\Column)#1356 (16) {
  ....
 }
["password"]=>
  object(Doctrine\DBAL\Schema\Column)#1355 (16) {
...
 }
  ["`admin`"]=>
  object(Doctrine\DBAL\Schema\Column)#1367 (16) {
    ["_name":protected]=>
    string(5) "admin"
    ["_namespace":protected]=>
    NULL
    ["_quoted":protected]=>
    bool(false)
    ["_type":protected]=>
    object(Doctrine\DBAL\Types\SmallIntType)#1282 (0) {
    }
    ["_length":protected]=>
    NULL
    ["_precision":protected]=>
    int(10)
    ["_scale":protected]=>
    int(0)
    ["_unsigned":protected]=>
    bool(true)
    ["_fixed":protected]=>
    bool(false)
    ["_notnull":protected]=>
    bool(true)
    ["_default":protected]=>
    string(1) "0"
    ["_autoincrement":protected]=>
    bool(false)
    ["_platformOptions":protected]=>
    array(0) {
    }
    ["_columnDefinition":protected]=>
    NULL
    ["_comment":protected]=>
    NULL
    ["_customSchemaOptions":protected]=>
    array(0) {
    }
  }
  ["usergroup"]=>
  object(Doctrine\DBAL\Schema\Column)#1363 (16) {
    ....
  }

( the "..." above is just me cropping out irelevant info. )

The problem is that the json object contains the key "admin" where as $columns only contains "`admin`" ( mysql escape )

The quick & dirty solutions would be to loop over the $columns array like so:

        foreach ( $columns as $key=>$val ){
          $columns[trim($key,'`')]=$val;
       }
      

Which would effectively create a duplicate for escaped keys - not a pretty solution by any means, but it works (tested).

Any better way to fix it?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions