[midPoint] ScriptedSQL and Account Intent

Loïc Schamber lschamber at serial.ch
Wed Feb 19 17:26:17 CET 2020


Thanks you for your reply Gustav,

Indeed using objectClass is a goody idea to achieve my goal.
Sadly I struggle to implement what you proposed: I don’t achieve to get something else than “__ACCOUNT__” in the objectClass script attribute.
I tried to define multiple objectClasses in the schema but I think there is something that I don’t get concerning objectClasses.

Here are my current schema and Schema handeling definition for the ScriptedSQL Ressource:

<xsd:schema elementFormDefault="qualified" targetNamespace="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">
< !—Namespaces-->
<xsd:complexType name="AccountObjectClass">
<xsd:annotation>
<xsd:appinfo>
<ra:resourceObject/>
<ra:identifier>icfs:uid</ra:identifier>
<ra:secondaryIdentifier>icfs:name</ra:secondaryIdentifier>
<ra:displayNameAttribute>icfs:name</ra:displayNameAttribute>
<ra:namingAttribute>icfs:name</ra:namingAttribute>
<ra:nativeObjectClass>__APPACCOUNT__</ra:nativeObjectClass>
</xsd:appinfo>
              </xsd:annotation>
<xsd:sequence>
              <!—Attributes -->
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
<schemaHandling>
<objectType>
<displayName>App1 Account</displayName>
<kind>account</kind>
<intent>APP1</intent>
<objectClass>ri:AccountObjectClass</objectClass>
<!—Attributes handling -->
              </objectType>
</schemaHandling>

In the schema I tried to another objectClass with the following definition but if I change the  name of the complexType to something else than “AccountObjectClass” ( like AccountAPP1 ) and use this new name in the objectClass attribute of the schema handling I have the following error:
Cannot recognize objectclass QName {http://midpoint.evolveum.com/xml/ns/public/resource/instance-3}AccountAPP1 for connector: ConnId com.evolveum.polygon.connector.scripted.sql.ScriptedSQLConnector v2.1 , expected: http://midpoint.evolveum.com/xml/ns/public/resource/instance-3

Can you explain to me how I am supposed to defines multiple object classes  to manages accounts?

Thanks a lot,
Loïc Schamber  | Junior IT Consultant

[logo]<https://www.serial.ch/>

lschamber at serial.ch<mailto:lschamber at serial.ch> |  +41 22 555 27 69<tel:+41%2022%20555%2027%2069>
Chemin du Pré-Fleuri 5 – CH 1228 Plan-les-Ouates
[LinkedIn]<https://www.linkedin.com/company/redcactus-by-positivethinkingcompany>  [Instagram] <https://www.instagram.com/positivethinkingcompany>
Redcactus by SERIAL www.serial.ch<www.serial.ch>
www.positivethinking.co

________________________________
Help save paper, do you really need to print this email?
The content of this email and any attachments are confidential and are intended solely for the person and/or company to whom they are addressed. The information may also be legally privileged. No employee or agent is authorized to conclude any binding agreement on behalf of SERIAL with another party by email without express written confirmation. If you have received this email in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by return E-mail and delete this message, its attachments and all copies from your system. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. Thank you for your cooperation.

From: midPoint <midpoint-bounces at lists.evolveum.com> On Behalf Of Pálos Gustáv
Sent: mercredi, 19 février 2020 08:31
To: midPoint General Discussion <midpoint at lists.evolveum.com>
Subject: Re: [midPoint] ScriptedSQL and Account Intent

Hi,

you can use attribute objectClass instead of intent like this:

switch (objectClass) {
    case ObjectClass.ACCOUNT_NAME:
        //TODO
        break;
    case "AccountApplication2":
          //TODO
        break;
    case "AccountApplication3":
          //TODO
        break;
    default:
        throw new ConnectorException("Unknown object class $objectClass");
}

Best regards,

Gustav

ut 18. 2. 2020 o 15:58 Loïc Schamber <lschamber at serial.ch<mailto:lschamber at serial.ch>> napísal(a):
Hi everyone,

I am currently deploying midpoint and I am using the ”ConnId com.evolveum.polygon.connector.scripted.sql.ScriptedSQLConnector v2.1“

I have to manage account for multiple custom application, but all those applications use on the same database to manage accounts.
So I have a table called USER_ACCOUNTS where the key composed of two fields : the name of the user and the name of the application. This table also have multiple other fields to store user data (Phone number, mail, ..)
If an user have multiple account, he will be inserted multiple time in this table with different applications names.
What I was planning to do is to use multiple account intents to allow an user having multiple account on the ScriptedSQL resource.
As the APP name is a field the database  table I also managed it as a schema attribute (app_name) and the outbound mapping of this attribute was the AppName. (Which is the same as the intent name)

It is working for the CreateScript.groovy as I get all the required attributes  to create the user but I have a problem with the Update and Delete scripts:
In the delete script, no user attributes are given except the user uid and in the update script, only the attributes that need to be updated are passed to the script. So I cannot retrieve the application name from the attribute (Which I did in the create script).
In the same way, I don’t seems to be able to retrieve the intent on the scripts, so I can not use it either.

Is there a way to retrieve intent on the ScriptedSQL scripts, so I can use it to manage different account type in groovy scripts?

I also cannot use the DatabaseTable connector because I need to update multiple tables on the database when inserting an user.
I will add that I am not the one in charge of the database architecture and I am not able to change it.

Thanks for your help,

Loïc Schamber  | Junior IT Consultant

[logo]<https://www.serial.ch/>

lschamber at serial.ch<mailto:lschamber at serial.ch> |  +41 22 555 27 69<tel:+41%2022%20555%2027%2069>
Chemin du Pré-Fleuri 5 – CH 1228 Plan-les-Ouates
[LinkedIn]<https://www.linkedin.com/company/redcactus-by-positivethinkingcompany>  [Instagram] <https://www.instagram.com/positivethinkingcompany>
Redcactus by SERIAL www.serial.ch<http://www.serial.ch>
www.positivethinking.co<http://www.positivethinking.co>

________________________________
Help save paper, do you really need to print this email?
The content of this email and any attachments are confidential and are intended solely for the person and/or company to whom they are addressed. The information may also be legally privileged. No employee or agent is authorized to conclude any binding agreement on behalf of SERIAL with another party by email without express written confirmation. If you have received this email in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by return E-mail and delete this message, its attachments and all copies from your system. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. Thank you for your cooperation.

_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
http://lists.evolveum.com/mailman/listinfo/midpoint


--
s pozdravom

Gustáv Pálos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20200219/61e6b134/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 6827 bytes
Desc: image001.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20200219/61e6b134/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 451 bytes
Desc: image002.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20200219/61e6b134/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 1129 bytes
Desc: image003.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20200219/61e6b134/attachment-0002.png>


More information about the midPoint mailing list