How to handle SmartObjects for ADAM Users

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 3 Replies | 2 Followers

Not Ranked
7 Posts
Points 19
JyothiV posted on Fri, Mar 5 2010 7:37 AM

Hi,

At present I have written the following code to connect to smart objects. This is working fine for AD users. Could anyone please give some code how to handle this for ADAM users.

 

  public string ExecuteNonQuerySmartObjectMethod(string smartObjectName, string smoMethod, Dictionary<string, object> properties, string returnProp)

        {

            string id = string.Empty;

            try

            {

                SmartObjectServer.Connection.Open(connectionString);

                SmartObject smoExec = SmartObjectServer.GetSmartObject(smartObjectName);

                smoExec.MethodToExecute = smoMethod;

 

                foreach (string prop in properties.Keys)

                    if (properties[prop] != null && smoExec.Methods[smoMethod].InputProperties.Contains(prop))

                        smoExec.Methods[smoMethod].InputProperties[prop].Value = properties[prop].ToString();

 

                smoExec = SmartObjectServer.ExecuteScalar(smoExec);

 

                if (smoExec != null)

                {

                    id = smoExec.Methods[smoMethod].ReturnProperties[returnProp].Value;

                }

            }

            catch (SmartObjectException er)

            {

                FormatAndThrowSmartObjectException(er);

 

            }

            finally

            {

                SmartObjectServer.Connection.Close();

                SmartObjectServer = null;

            }

 

            return id;

        }

 

 

  • | Post Points: 4

All Replies

Top 50 Contributor
150 Posts
Points 506
Answered (Not Verified) Gert replied on Sun, Mar 7 2010 9:59 AM
Suggested by Gert

Hi Jyothi,

Seeing as you are starting a process on the create event on the smartobject I would suggest that you run the open connection with elevated privileges and opening the connection in the very same way you are already doing so. Note that this would require the application pool account to have rights to start the process. I would then suggest that you add a new field to the SmartObject storing the user email address that is currently logged on (ADAM or AD). If my memory serves you only used the originator to send emails of the status of the workflow. If this is the case you wont need anything more than the email address. Now re-map the smartobject properties once you created them to the corresponding process fields and use the field in the process where you need to send  mails to the originator.

Regards,

Gert

The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.

  • | Post Points: 4
Not Ranked
7 Posts
Points 19

Hi Gert,

Thank you very much for responding to my forum. 

At present I am running with elevated privileges but I need to clarrify that before opening the smartobject server connection do I need to check IsAdamUser() and Impersonate this ADAM User .

This is the code at present i am using....

 

public string ExecuteNonQuerySmartObjectMethod(string smartObjectName, string smoMethod, Dictionary<string, object> properties, string returnProp)

        {

            string id = string.Empty;

            try

            {

                SmartObjectServer.Connection.Open(connectionString);

                SmartObject smoExec = SmartObjectServer.GetSmartObject(smartObjectName);

                smoExec.MethodToExecute = smoMethod;

 

                foreach (string prop in properties.Keys)

                    if (properties[prop] != null && smoExec.Methods[smoMethod].InputProperties.Contains(prop))

                        smoExec.Methods[smoMethod].InputProperties[prop].Value = properties[prop].ToString();

 

                smoExec = SmartObjectServer.ExecuteScalar(smoExec);

 

                if (smoExec != null)

                {

                    id = smoExec.Methods[smoMethod].ReturnProperties[returnProp].Value;

                }

            }

            catch (SmartObjectException er)

            {

                FormatAndThrowSmartObjectException(er);

 

            }

            finally

            {

                SmartObjectServer.Connection.Close();

                SmartObjectServer = null;

            }

 

            return id;

        }

 

 

  • | Post Points: 4
Top 50 Contributor
150 Posts
Points 506
Gert replied on Wed, Mar 10 2010 12:04 AM

Hi Jyothi,

No in this case you would not need to impersonate the user as the Application pool account will create the SmartObject entry and start the workflow. You do need to save the logged on user's email address or user name, depending on what you need o use in the workflow, into one of the SmartObject fields. Once you have done this you need to map this smartobject field to a corresponding field in the workflow and use it where needed.

 

Cheers,

Gert

The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.

  • | Post Points: 1
Page 1 of 1 (4 items) | RSS