xperseguers / t3ext-ig_ldap_sso_auth

TYPO3 Extension ig_ldap_sso_auth. This extension provides LDAP and SSO support for TYPO3.
https://extensions.typo3.org/extension/ig_ldap_sso_auth
27 stars 63 forks source link

Change sql for insert when importing new users for not synched fields #154

Closed klodeckl closed 1 year ago

klodeckl commented 1 year ago

Hello, I have a custom field with relation to another table entry (as csv) which is NOT synched via ldap. I had to change the database definition to not allow null as value (because otherwise I get an extbase error in femanager: “Object of class TYPO3\CMS\Extbase\Persistence\ObjectStorage could not be converted to string”). But now when I try to sync the users I get an error: Column 'room' cannot be null. How can I tell ig_ldap_sso_auth to use an empty string instead of null?

xperseguers commented 1 year ago

Did you properly configure that custom field in TCA? Because the extension is supposed to use the default value configured in TCA when preparing a record to be added to the DB...

klodeckl commented 1 year ago

This is my TCA for the field. I changed the db field to tinytext instead of int (because I want to store csv and in csv there is a comma). I think the classic m:n relation would use NULL for no relation, that is why the import wants to use NULL. But I don’t know how to make '' as default value instead of NULL.

'room' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:ext/Resources/Private/Language/locallang_db.xlf:tx_ext_domain_model_persons.room',
    'config' => array(
        'type' => 'select',
        'renderType' => 'selectSingleBox',
        'foreign_table' => 'tx_ext_domain_model_rooms',
        'foreign_table_where' => 'AND 1=1 Order by location, building, uid, number ASC',
        'minitems' => 0,
        'maxitems' => 10,
    ),

If I create a new fe_user in the backend, the record is not created withh NULL values.

xperseguers commented 1 year ago

See https://github.com/xperseguers/t3ext-ig_ldap_sso_auth/blob/master/Classes/Library/Authentication.php#L213-L222 and https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/selectSingle.html#default, if you set

'config' => array(
    //...
    'default' => '',
),

that should do the trick.

klodeckl commented 1 year ago

Thanks, it worked! :)