Is it possible to create a version for another OS user? We use the Workflow Manager to manage our jobs and the technicians are the ones who create the jobs and it's based off their Operating System account ("DOMAIN\ABC123") and we use fingerprint readers. When I'm performing maintenance I remove all versions to obtain a State 0 compression. After this the user must go back in and recreate versions for any open jobs. I would like to automatic if possible. I know the OS names for those users and the versions that need to be recreated, but if I use the GUI it will default to my OS account.
I'm thinking Python would be the best way to conquer this, any suggestions?
Thank you.
There is a Create Version tool in the toolbox, therefore it can be scripted in python.
I have no idea how actual users are handled though.
I don't work with fingerprint readers, but I assume credentials from logging in with fingerprint readers can be cached like when using a username and password. If so, I would script out the creation of new versions, using the tool Neil Ayres suggests, and then create a bunch of scheduled tasks on a machine to have the script run under each user profile after the maintenance work has been done. If your security settings in your company force users to be logged in for their scheduled tasks to run, then you might have to set up the scheduled task as a login task/script.
Thank you but that will not be an option. The Create Version tool will set the owner as the OSA login (matching the SDE connection file). I would either have to default back to DB logins or find some type of way to override the version owner to match the OSA login name.
I'm looking around now to see if there is a way to change the owner of a version once created. Worse case I'll let my python script run monthly and email them a list of the jobs that they'll need the versions recreated.
OSA login is never a user, a specific user, it is a flag to tell the software to use the credentials of the currently running process that is initiating the connection. You can have a single script that uses the same SDE connection file (with OSA authentication) but creates different versions for different users. The scheduled task the executes the code just needs to run under each user's credentials, which can be stored/cached when the task is scheduled. Similar to how Windows services can be run under different user or system credentials, so can scheduled tasks, but the user would have to be there with you to set it up since his/her fingerprint will be requested when changing the execution credentials of the task.
I can't recall ever hearing about changing version owners after versions are created. There might be some kind of hack, but it seems risky/unstable.
Thanks Josh, that could also be considered. I may just process a CSV list and use it as an input parameter for a script that the user will need to run instead of a scheduled task.
I see that the Create Version tool need access to a connection file, which will of course identify the user.
If you had a collection of these you could script it.
Thank you for the suggestions and information on this topic. There was no way to create a version as another OS user so I ended up writing a couple of different scripts to tackle the issue a another way. The first script will get a list of current versions, filter it by owner, generate a CSV file, and then email the file to the original version owner.
The second script will be ran by the end user to process the CSV provided.
Quick and dirty, but it works.
# --------------------------------------------------------------------------- # Create Version from CSV file # Created on: 2015-10-21 by Daniel Johns # Description: Processes a CSV file (list) and creates a version for each row provided. # --------------------------------------------------------------------------- # Import arcpy module import arcpy import csv # Static path to workspace and parent version inWorkspace = "Path to Workspace i.e C:\\Connections\\DB.sde" parentVersion = "dbo.DEFAULT" # Path to CSV (set up as script parameter) csvFile = arcpy.GetParameterAsText(0) f = open(csvFile, "r") lines = f.read().split("\n") # Capitalizes and processes each row provided (creates the version) for line in lines: if line != "": val = line.split(",") val =[x.upper() for x in val] val = str(val).replace("['","").replace("']","") print "Creating version for " + val versionName = val arcpy.CreateVersion_management(inWorkspace, parentVersion, versionName, "PUBLIC") print "Created." print "Finished"