0

Adding user info to events generated by API Scripts

So was wondering the best way to make events not only link to the script and key used to enter data but also possibly link each event to the corrisponding user if possible.  Attached is a sample of a piece of one of our custom tools.

# -----------------------------------------------------------------------------
SERVER_PATH         = <Server>
API_VERSION         = 'api2'
SCRIPT_USER         = <Script User>
SCRIPT_KEY          = <Script Key>
OBSERVER_INTERVAL   = 1
# -----------------------------------------------------------------------------
sg = Shotgun(SERVER_PATH, SCRIPT_USER, SCRIPT_KEY)

 

Is it possible to include some values for the 'entity' field like:

{'type' : 'HumanUser', 'id' : userData[181] }

 

If so how do I go about linking the events to users?

 

-Romey

 

07-14-2010 (kp) Updated title to be more descriptive

5 comments

  • 0
    Avatar
    Isaac Reuben

    Hey Romey, so the goal is have a user interacting with a script that you wrote, which is then using the API to talk to Shotgun, and you want to record in Shotgun that the actions are being done not just by the script but also on behalf of the user?  We've got an idea on a way to handle that, by adding a permission to allow scripts (or admin users) to pretend to be other users.  Does that sound like it might work for you?

     

    - Isaac

  • 0
    Avatar
    Mike Romey

    Yes, that sound like it would work.


    -Romey

  • 0
    Avatar
    Rob Blau

    Any word on this?  We're starting to do a bunch through scripts which makes the history log much less useful than it could be.  It would be great to be able to set the user you are proxying for when connecting via the API and have that reflected somehow in the created by/updated by/event log.  Even better would be if the permissions for any given action would be allowed only if the script and the user the script is proxying for have permissions to do that action.

    -r

  • 0
    Avatar
    KP

    We're actually working on this now in allowing scripts to authenticate with a user/password do you could run a script and authenticate as yourself and therefore have the trail you need. 

    We're in a QA process for this right now and we'll want to make sure it's working as expected, is backwards compatible, etc. So expect to see it shortly... :)

  • 0
    Avatar
    KP

    Update on this. While we have enabled authenticating by user/password under the hood required for our integration work with partner products like cineSync, RV, and Qube, this is not currently able to attach the additional user info to the EventLogEntries yet. We're still working on that. 

Please sign in to leave a comment.