[prev in list] [next in list] [prev in thread] [next in thread] 

List:       forgerock-openidm
Subject:    Re: [OpenIDM] RE : RE : Groovy Connector Toolkit + scriptArguments
From:       Gael Allioux <gael.allioux () forgerock ! com>
Date:       2015-03-31 20:48:27
Message-ID: 551B081B.8030807 () forgerock ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    normally... you had that property in the provisioner file<br>
    <br>
    "scriptOnResourceScriptFileName": "MyScriptOnResourceScript.groovy"<br>
    <br>
    like you do for create, update etc...<br>
    <br>
    then when you call it from REST you need to add
    scriptExecuteMode=resource as a parameter, otherwise it will default
    to scriptOnConnector<br>
    <br>
    and last... you would have to use scriptArguments in your script to
    access variables.<br>
    <br>
    try if you want... and let us know <br>
    (we may need to clean up the doc a bit on that one...)<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 03/31/2015 10:41 PM,
      Belleville-Rioux, Vincent wrote:<br>
    </div>
    <blockquote
      cite="mid:0AD36E0192997748BD28BC68B14C75D01646A2DD@Lettre.gst.uqam.ca"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div style="direction: ltr;font-family: Tahoma;color:
        #000000;font-size: 10pt;">Quick other question : how do you
        define a scriptOnResource in the provisioner.conf file?
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <div>Vincent<br>
          <div><br>
            <div style="font-family:Tahoma; font-size:13px">
              <div style="font-family:Tahoma; font-size:13px">
                <div style=""><br>
                </div>
              </div>
            </div>
          </div>
          <div style="font-family: Times New Roman; color: #000000;
            font-size: 16px">
            <hr tabindex="-1">
            <div id="divRpF450541" style="direction: ltr;"><font
                color="#000000" face="Tahoma" size="2"><b>De :</b>
                <a class="moz-txt-link-abbreviated" \
                href="mailto:openidm-bounces@forgerock.org">openidm-bounces@forgerock.org</a>
                
                [<a class="moz-txt-link-abbreviated" \
href="mailto:openidm-bounces@forgerock.org">openidm-bounces@forgerock.org</a>] de la \
                part de Gael
                Allioux [<a class="moz-txt-link-abbreviated" \
href="mailto:gael.allioux@forgerock.com">gael.allioux@forgerock.com</a>]<br>  <b>Date \
                d'envoi :</b> 31 mars 2015 16:04<br>
                <b>À :</b> <a class="moz-txt-link-abbreviated" \
href="mailto:openidm@forgerock.org">openidm@forgerock.org</a><br>  <b>Objet :</b> Re: \
[OpenIDM] RE : Groovy Connector  Toolkit + scriptArguments<br>
              </font><br>
            </div>
            <div><br>
              <br>
              <div class="moz-cite-prefix">On 03/31/2015 08:42 PM,
                Belleville-Rioux, Vincent wrote:<br>
              </div>
              <blockquote type="cite">
                <style type="text/css" id="owaParaStyle"></style>
                <div style="direction:ltr; font-family:Tahoma;
                  color:#000000; font-size:10pt">Salut Gael,
                  <div><br>
                  </div>
                  <div>We're trying to add an unlock account
                    functionality through a ScriptedSQL provisioner.
                     That functionality would be triggered by an
                    external system through a REST call.</div>
                  <div><br>
                  </div>
                  <div>provisioner.conf :</div>
                  <div><br>
                  </div>
                  <div>{</div>
                  <div>
                    <div>    "name" : "mysystem",</div>
                    <div>    "connectorRef" : {</div>
                    <div>        "bundleName" :
                      "org.forgerock.openicf.connectors.groovy-connector",</div>
                    <div>        "bundleVersion" : "1.4.1.0",</div>
                    <div>        "connectorName" :
                      \
"org.forgerock.openicf.connectors.scriptedsql.ScriptedSQLConnector"</div>  <div>    \
},</div>  </div>
                  <div>(...)</div>
                  <div>
                    <div>    "systemActions" : [</div>
                    <div>        {</div>
                    <div>            "scriptId" : "UnlockAccount",</div>
                    <div>            "actions" : [</div>
                    <div>                {</div>
                    <div>                    "systemType" :
                      ".*ScriptedSQLConnector",</div>
                    <div>                    "actionType" : "Groovy",</div>
                    <div>                    "actionFile" :
                      "script/provisioners/mysystem/UnlockAccount.groovy"</div>
                    <div>                }</div>
                    <div>            ]</div>
                    <div>        }</div>
                    <div>    ],</div>
                  </div>
                  <div>(...)</div>
                  <div><br>
                  </div>
                  <div>Then, calling that through a REST call :</div>
                  <div><br>
                  </div>
                  <div>/openidm/system/mysystem?_action=script&amp;scriptId=UnlockAccount&amp;userName=test</div>
  <div><br>
                  </div>
                  <div>The UnlockAccount.groovy script is launched (we
                    can confirm from the logs), but we'd like to be able
                    to read the actual userName parameter.</div>
                </div>
              </blockquote>
              userName parameter should be injected in the script since
              you're going to run a "scriptOnConnector" action<br>
              <br>
              I think  "scriptArguments" would be injected if you were
              running "scriptOnResource" action.<br>
              <br>
              <br>
              <blockquote type="cite">
                <div style="direction:ltr; font-family:Tahoma;
                  color:#000000; font-size:10pt">
                  <div><br>
                  </div>
                  <div>Otherwise, we'd be interested in another approach
                    if we could do a REST call like :</div>
                  <div><br>
                  </div>
                  <div>/openidm/system/mysystem/account/test?_action=script&amp;scriptId=UnlockAccount</div>
  </div>
              </blockquote>
              <br>
              why don't you just write your own custom endpoint ?<br>
              <br>
              <br>
              <blockquote type="cite">
                <div style="direction:ltr; font-family:Tahoma;
                  color:#000000; font-size:10pt">
                  <div><br>
                  </div>
                  <div>But we couldn't figure out any way to do that
                    from the samples / docs.</div>
                  <div><br>
                  </div>
                  <div>Thanks,</div>
                  <div><br>
                  </div>
                  <div>Vincent<br>
                    <div><br>
                      <div style="font-family:Tahoma; font-size:13px">
                        <div style="font-family:Tahoma; font-size:13px">
                          <div style=""><br>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div style="font-family:Times New Roman;
                      color:#000000; font-size:16px">
                      <hr tabindex="-1">
                      <div id="divRpF239170" style="direction:ltr"><font
                          color="#000000" face="Tahoma" size="2"><b>De :</b>
                          <a moz-do-not-send="true"
                            class="moz-txt-link-abbreviated"
                            href="mailto:openidm-bounces@forgerock.org"
                            target="_blank">
                            openidm-bounces@forgerock.org</a> [<a
                            moz-do-not-send="true"
                            class="moz-txt-link-abbreviated"
                            href="mailto:openidm-bounces@forgerock.org"
                            target="_blank">openidm-bounces@forgerock.org</a>]
                          de la part de Belleville-Rioux, Vincent [<a
                            moz-do-not-send="true"
                            class="moz-txt-link-abbreviated"
                            href="mailto:rioux.vincent@uqam.ca"
                            target="_blank">rioux.vincent@uqam.ca</a>]<br>
                          <b>Date d'envoi :</b> 31 mars 2015 13:59<br>
                          <b>À :</b> <a moz-do-not-send="true"
                            class="moz-txt-link-abbreviated"
                            href="mailto:openidm@forgerock.org"
                            target="_blank">
                            openidm@forgerock.org</a><br>
                          <b>Objet :</b> [OpenIDM] Groovy Connector
                          Toolkit + scriptArguments<br>
                        </font><br>
                      </div>
                      <div>
                        <div style="direction:ltr; font-family:Tahoma;
                          color:#000000; font-size:10pt">Hi,
                          <div><br>
                          </div>
                          <div>How can we access the script arguments
                            when using the Groovy Connector Toolkit?</div>
                          <div><br>
                          </div>
                          <div>We tried doing something like this :</div>
                          <div>def scriptArguments = scriptArguments as
                            ScriptArguments<br>
                            <div><br>
                            </div>
                            <div>log.info(scriptArguments.toString())</div>
                            <div><br>
                            </div>
                            <div>But that Map doesn't seem to exist.</div>
                            <div>
                              <div style="font-family:Tahoma;
                                font-size:13px">
                                <div style="font-family:Tahoma;
                                  font-size:13px">
                                  <div style=""><br>
                                  </div>
                                  <div style="">Thanks,</div>
                                  <div style=""><br>
                                  </div>
                                  <div style="">Vincent</div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <br>
                <fieldset class="mimeAttachmentHeader" target="_blank"></fieldset>
                <br>
                <pre>_______________________________________________
OpenIDM mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" \
href="mailto:OpenIDM@forgerock.org" target="_blank">OpenIDM@forgerock.org</a> <a \
moz-do-not-send="true" class="moz-txt-link-freetext" \
href="https://lists.forgerock.org/mailman/listinfo/openidm" \
target="_blank">https://lists.forgerock.org/mailman/listinfo/openidm</a> </pre>
              </blockquote>
              <br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
OpenIDM mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:OpenIDM@forgerock.org">OpenIDM@forgerock.org</a> <a \
class="moz-txt-link-freetext" \
href="https://lists.forgerock.org/mailman/listinfo/openidm">https://lists.forgerock.org/mailman/listinfo/openidm</a>
 </pre>
    </blockquote>
    <br>
  </body>
</html>



_______________________________________________
OpenIDM mailing list
OpenIDM@forgerock.org
https://lists.forgerock.org/mailman/listinfo/openidm


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic