What version of TeamSite are you running?java code runs as iwui in 671 and higher, it looks like it is running as system in your machine.see this thread
Interesting. I don't like ending up with another EA set, though. At least I got the "Modified By" set when I tried the iwextattr command.
CSClient client; //you'll want to get this from the session, not from a factoryDate date = new Date();for (String vpath : vpaths) { CSVPath vpath = new CSVPath(vpath).getPathNoServer(); CSFile csFile = client.getFile(vpath); CSUser owner = csFile.getOwner(); File jfile = new File("Y:" + vpath); //if windows, but you get the idea jfile.setLastModified(date.getTime()); csFile.setOwner(owner);}
The funny thing is, if I run code similar to above, BUT without any of the CSSDK stuff, the last modifer for me remains unchanged (at least as I view in ContentCenter).
Yep owner attr is different than "Modified by"... i couldn't find anything in CSSDK to set modified by, that is why i ended up adding an EA named "Modified by"... i explained the disadvantages of doing it this way in the other thread.
boolean p = csFile.isPrivateToWorkarea();csFile.setPrivateToWorkarea(p);
I am not sure I see your point.Of course owner and modified by are two different atts. If they were the same, why would you need two of them?
If you make a change -- any change -- to a file using the CSSDK, the last modifier is set to the CSUser that made the change. CSClient client; //you'll want to get this from the session, not from a factoryDate date = new Date();for (String vpath : vpaths) { CSVPath vpath = new CSVPath(vpath).getPathNoServer(); CSFile csFile = client.getFile(vpath); CSUser owner = csFile.getOwner(); File jfile = new File("Y:" + vpath); //if windows, but you get the idea jfile.setLastModified(date.getTime()); csFile.setOwner(owner);}
The CSSDK part ensures the last modifier is who you want it to be if it gets messed up.
This issue really isn't "impersonation". It's who's doing what. If you use the CSSDK to change a file, even if the change doesn't really change it, the last modifier will be changed to the user who did the change.
i wish that was true, my experience with using CSSDK is that it runs as iwui whether i invoke it from a WF or from custom action/tab in TeamSite ( TS671 and 672)... every time i print "System.getProperty("user.name")", i get iwui. which is different than the actual user running the workflow( CSClient.getCurrentUser()) or taking action in teamsite (httpRequest.getAttribute(csclient attribute)).if you think this is not true, then i am probably doing something wrong or my teamsite is missing something. and i would love to figure out what i am missing.
....The only way that scenario would make sense is when it's confusing about from where the CSClient actually comes, like:- in a workflow task - or if you're using a CSFactory and "getCurrentUser()" -- which is terribly named because it doesn't do what its name makes it seems like it would do - or if you had a servlet that simply used plain old java to modify a file. But not through the CSSDK.
Also, I'm not sure I followed what you meant with the System.getProperty("user.name"). Of course this would always be "iw.ui", right? That's the user under which the servlet engine (iwservletd) is running.
now is that impersonation issue?how would you get around this to show the actual user invoked the code as the modified by?just in case of the answer is "CSSDK", well, can you do everything with CSSDK?