Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Why does one get owned by 'test' and another by 'Admin'
Robert_Davies_(unlondonadmin_-_(deleted))
Hi folks.In the $LLIAPI.AdminPkg.UserCreate() function there is some code to create the users workbin (personal workspace).I have tacked on another bit of code, nearly identical to create a folder inside that workspace.What's puzzling me is that the workbin gets created owned by 'test' my new user name, but the folder gets created owned by 'Admin'.Here is the code, which I add just after the if/end block that creates the workbin.if ok llnode = $LLIAPI.LLNodeSubsystem.GetItem( $TypeFolder ) result = llnode.NodeAlloc( dapiCtx, "Test Folder" ) if !result.OK ok = FALSE rtnval = result else DAPINode folder = result.Node createInfo = Assoc.CreateAssoc() createInfo.UserID = userRec.ID createInfo.GroupID = userRec.GroupID result = llnode.NodeCreate( folder, workbin, createInfo ) if !result.OK ok = FALSE rtnval = result end endendCan someone explain why they created with different creator/owner id's?Best regards/matt.
Find more posts tagged with
Comments
Bickers
Matt,The reason for this is that the creation code for the Workbin itself sets the node's userid etc. to the new user's settings, whereas creating a folder just sets the owner etc. to whoever is currently logged in.Take a look at the VolWorkBin LLNode object in LLIAPI. The 'NodeCreateSubclassPre' script has been overriden to accept user details and changes the node's features accordingly. A Folder's create scripts do not accept user details as you are trying to pass in your creatinfo object.What you need to do is use similar code to 'NodeCreateSubclassPre' in your script, before calling llnode.NodeCreate().Hope this helps,Phil.
Robert_Davies_(unlondonadmin_-_(deleted))
Hi Phil.Yes I think this could be very helpful. I'll test it tomorrow if I can and post the results.Many thanks for the info.Best regards/matt.
Robert_Davies_(unlondonadmin_-_(deleted))
Hi Phil.In fact I tested it now since the code looked pretty easy. The only line I didn't copy from the reference NodeCreateSubClassPre() method was the line node.pVolumeID = -userRec.IDSince I assume the VolumeID is assigned during the NodeCreate because I specify in that call that the folder is being created in the workbin.Everything seemed to work fine, the owner & creator look ok. Brilliant! Many thanks!Best regards/matt.----llnode = $LLIAPI.LLNodeSubsystem.GetItem( $TypeFolder )result = llnode.NodeAlloc( dapiCtx, "Test Folder" )if !result.OK ok = FALSE rtnval = resultelse DAPINode folder = result.Node createInfo = Assoc.CreateAssoc() folder.pUserID = userRec.ID folder.pCreatedBy = userRec.ID folder.pGroupID = userRec.GroupID folder.pGroupPerm = $PRemoveNode folder.pWorldPerm = $PRemoveNode result = llnode.NodeCreate( folder, workbin, createInfo )----
Deepika_Kowkuntla_(nidauser2_-_(deleted))
Thanks for the tip Matt. I have placed the code in the "Excellent" post in the LLIAPI.AdminPkg.UserCreated method and it runs fine.What I'd really like to do is orphan LLIAPI.AdminPkg into one of our site custom modules and install the modified code there. However, when I do this LLIAPI method always executes instead my orphaned method.I have done all of the usual Build OSpace, Save OSpace, restart the Builder stuff but the LLIAPI version always fires. I did not see an fEnabled feature for AdminPkg. Is this something that can be orphaned? I hate to make mods directly to vendor modules that might be lost in an upgrade.Thanks,Paul
Deepika_Kowkuntla_(nidauser2_-_(deleted))
Thanks to Donna Nalls for this solution:Copy the text in the UserCreated() script, and create a new script in one of your objects (I usually create a Utils object under my Root object for these sorts of things.). Don?t forget to add your Utils object to your globals, build ospace, etc.... you know all that.Make your modifications in your new script.In your ospace?s Root.Startup() method, add this line: $LLIAPI.AdminPkg.UserCreated = yourmodule.Utils.UserCreatedThis should work, because AdminPkg is a global object within $LLIAPI, and your Utils (or whatever) object will be a global within your ospace.As an added precaution, you may want to orphan the LLIAPI.Root object into your OSpace. This will force the LLIAPI Ospace to load before your ospace. (although this is probably not necessary with LLIAPI, as it is usually one of the first to be loaded anyway?it doesn?t hurt to ensure it!)
Sury_Balasubramanian_(primav027_-_(deleted))
I am getting issues with doing the above in 9.1 because some of the functions that were global prior to 9.0 are not global anymore. Has anyone else faced the same problem?ThanksSury Balasubramanian
Kevin_Ward
Hi Sury,What global is missing in your installation? Livelink 9.1 SP3 should still contain the global variable $LLIAPI.AdminPkg.UserCreated. Perhaps the problem you're having is that the custom script in your ospace isn't added to your ospace's globals. This can be fixed by right-clicking on the object and selecting "Add To Globals".If this doesn't work, contact Bill again on this issue and he can put you in contact with me on the phone.Kevin