INSERT INTO `__APP__`.`login_source`
(`id`, `type`, `name`, `is_active`, `is_sync_enabled`, `cfg`, `created_unix`, `updated_unix`)
VALUES
(
    1,
    2,
    'YunoHost LDAP',
    1,
    1,
    '{
        "Name": "YunoHost LDAP",
        "Host": "localhost",
        "Port": 389,
        "SecurityProtocol": 0,
        "SkipVerify": false,
        "BindDN": "",
        "BindPassword": "",
        "UserBase": "ou=users,dc=yunohost,dc=org",
        "UserDN": "",
        "AttributeUsername": "uid",
        "AttributeName": "givenName",
        "AttributeSurname": "sn",
        "AttributeMail": "mail",
        "AttributesInBind": false,
        "AttributeSSHPublicKey": "",
        "AttributeAvatar": "",
        "SearchPageSize": 0,
        "Filter": "(&(uid=%s)(objectClass=posixAccount)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))",
        "AdminFilter": "(permission=cn=__APP__.admin,ou=permission,dc=yunohost,dc=org)",
        "RestrictedFilter": "",
        "Enabled": true,
        "AllowDeactivateAll": false,
        "GroupsEnabled": true,
        "GroupDN": "ou=groups,dc=yunohost,dc=org",
        "GroupFilter": "",
        "GroupMemberUID": "memberUid",
        "GroupTeamMap": __GROUP_TEAM_MAP__,
        "GroupTeamMapRemoval": true,
        "UserUID": "uid"
    }',
    UNIX_TIMESTAMP(NOW()),
    UNIX_TIMESTAMP(NOW()))
ON DUPLICATE KEY
UPDATE
    type=2,
    name='YunoHost LDAP',
    is_active=1,
    is_sync_enabled=1,
    cfg='{
        "Name": "YunoHost LDAP",
        "Host": "localhost",
        "Port": 389,
        "SecurityProtocol": 0,
        "SkipVerify": false,
        "BindDN": "",
        "BindPassword": "",
        "UserBase": "ou=users,dc=yunohost,dc=org",
        "UserDN": "",
        "AttributeUsername": "uid",
        "AttributeName": "givenName",
        "AttributeSurname": "sn",
        "AttributeMail": "mail",
        "AttributesInBind": false,
        "AttributeSSHPublicKey": "",
        "AttributeAvatar": "",
        "SearchPageSize": 0,
        "Filter": "(&(uid=%s)(objectClass=posixAccount)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))",
        "AdminFilter": "(permission=cn=__APP__.admin,ou=permission,dc=yunohost,dc=org)",
        "RestrictedFilter": "",
        "Enabled": true,
        "AllowDeactivateAll": false,
        "GroupsEnabled": true,
        "GroupDN": "ou=groups,dc=yunohost,dc=org",
        "GroupFilter": "",
        "GroupMemberUID": "memberUid",
        "GroupTeamMap": __GROUP_TEAM_MAP__,
        "GroupTeamMapRemoval": true,
        "UserUID": "uid"
    }',
    updated_unix=UNIX_TIMESTAMP(NOW());
