canCreate

In some cases you may want to create some objects from within an OScript function without any direct user involvement. In these situations you need to know if the user would be able to create the Object themselves prior to attempting the create as opposed to the try ... catch approach. The following code will return a Boolean indicating if the user could create an Object of the specified SubType in the specified Container :
				function boolean canCreate(Object prgCtx,DAPINode container,Integer subType)

				    Boolean retVal=false

				    // does the user have rights to CREATE objects in the specified container ?
				    Boolean containerPermissionsOK=$LLIAPI.NodeUtil.CheckPermissions(container,{$PCreateNode})

				    // does the user have the privelidge to create an Object of the specified SubType (based on ?func=admin.adminfactories)
				    Boolean createSubTypePrivOK=$LLIAPI.FactoryUtil.IsCreatable(prgCtx,subType)

				    // AND the two booleans to produce the overall result
				    retVal=(containerPermissionsOK && createSubTypePrivOK)

				    // return the result
				    return retVal
				end
			
The prgCtx can either be the current user's, or another's such as Admin. The container parameter is the Livelink Object in which you would like to create the new Node, e.g. a Folder, Project, Compound Document, Case etc. The final parameter subType is the Livelink Sub Type of the Node you are trying to create - see the Content Server / Livelink SubType list for more information on the different SubType's available in Content Server / Livelink, although this will be dependant on which modules you have installed.

Thus to use this to see if the current user can create a Folder, for which we will use the OScript constant $TypeFolder, in a Livelink container which has a DAPINode of containerDAPINode, we could use the following :

				Boolean userCanCreateFolderInNode=canCreate(prgCtx,containerDAPINode,$TypeFolder)
			
Website Designed by Adservio Consulting Valid HTML 4.01 Strict    Valid CSS!    Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0