Using CleverPath Forest and Trees to programmatically configure File Permissions when publishing to CleverPath Portal

Document ID : KB000055910
Last Modified Date : 14/02/2018
Show Technical Document Details

When publishing a file to CleverPath Portal there are a number of properties that may be configured which determine how that file will be handled. This document supplements the current CleverPath Forest and Trees 7.0 Help Topics, specifying definitions for a number of properties, including example code demonstrating the process of programmatically publishing a Microsoft Excel file to CleverPath Portal.

Object Properties

For any given object, the Object Wizard may be used to list properties and methods for that object. For publishing to the Portal, the particular object type of interest is 'PortalPublisher'.

To use the Object Wizard, a variable of the appropriate object type must be declared, either with a Dim statement or in the Tools > Variables dialog. Within the Edit Formula window, position the cursor after the Dim statement (if declared locally), select the Object Wizard button (the first one in the Edit Formula window toolbar), then select the desired object type and the variable representing an instance of that object type. On the next wizard page will be listed the methods and properties supported by that object, and a short description of the methods and their parameters (if any).

Portal Publisher properties

To demonstrate the usage of Portal Publisher properties an example FTV may be downloaded. The example provides code that will login to the Portal, set Portal permissions on a Microsoft Excel file, and publish the Microsoft Excel file to the CleverPath Portal.

The example portal_pub.ftv requires some configuration to function within a given environment. See the formula script for view 'publish'. The individual line of script requiring configuration are marked 'Change'.

Portal Parameters

Modify the view 'publish' formula script to configure the following Portal parameters

Change 1 - <portal Username>
Change 2 - <portal Server>
Change 3 - <port>
Change 4 - <password>

This will allow the application to login to the Portal

Publisher Parameters

Modify the view 'publish' formula script to configure the following Publisher parameters

Change 5 - Determine the object key for the parent folder in portal where you want to publish the file. Each folder in portal has an object key that can be found by logging in to the portal.

Eg) pp.Parent := 103

Change 6 - Specify the local path for the source file to be published (note the trailing slash)

Eg) sourceFilePath := 'C:\Documents and Settings\username\My Documents\My Excel\'

Change 7 - Specify the filename for source file to be published

Eg) sourceFileName := 'a.xls'

Change 8 - Specify the Title for the published content.

pp.Title := 'test excel' // optional--could duplicate file name

Change 9 - The (MIME) ContentType must be set to the appropriate value for the type of file being published. A table of the standard content types defined on CleverPath Portal is included at the end of this document. In the example this parameter is set for Excel.

Eg) pp.ContentType := 'application/vnd.ms-excel'

Change 10 - Change the GroupOwner to the object key of the Portal Workgroup that the content will belong. This can be found by logging into the Portal.

Eg) pp.GroupOwner := 72

Change 11 - Set the View/Modify Permissions for the published file. A table containing the available View/Modify permissions on CleverPath Portal is included at the end of this document.

Eg) pp.Permissions := 'GroupModify' // (or numeric equivalent: 504)

Change 12 - Set the Userowner for the published file to the object key of the Portal User. The object id for a Portal User can be found by logging into the Portal, or in the example ftv, this is retrieved automatically in View 'ps' through a portal statistics view.

Eg) pp.UserOwner := 22 // object key obtained from portal

Viewing published content

When the example ftv has been configured correctly, calculating the view 'publish' should result in the specified file being published to the Portal with the given permissions.

The example provided is intended to illustrate how permissions and other properties may be set when publishing content. It is likely that any programmatic publishing implementation will require additional design and coding dependent on the specific requirement and environment.

Sample code in this document is:

Copyright ? 2004 Computer Associates International, Inc. All rights reserved.

You have a royalty-free right to use, modify, reproduce, and distribute this sample code in any way you find useful, if you agree that Computer Associates has no warranty, obligations, or liability for any sample code.

Default ContentType parameters for CleverPath Portal

File ExtensionSet ContentType to this value
aifaudio/x-aiff
aifcaudio/x-aiff
aiffaudio/x-aiff
artx-jg
asfvideo/x-ms-asf
asxvideo/x-ms-asf
auaudio/basic
avivideo/x-msvideo
bmpimage/bmp
c++text/plain
ctext/plain
cctext/plain
classapplication/x-java
cpptext/plain
docapplication/msword
dtdtext/plain
exeapplication/octet-stream
gifimage/gif
h++text/plain
htext/plain
htmtext/html
htmltext/html
iviapplication/vision
javatext/plain
jfifimage/pjpeg
jpeimage/jpeg
jpegimage/jpeg
jpgimage/jpeg
m1vvideo/mpg
movvideo/quicktime
mp2video/mpg
mpavideo/mpg
mpevideo/mpg
mpegvideo/mpg
mpgvideo/mpg
pacapplication/x-ns-proxy-autoconfig
pdfapplication/pdf
pltext/plain
pngimage/png
potapplication/vnd.ms-powerpoint
ppaapplication/vnd.ms-powerpoint
ppsapplication/vnd.ms-powerpoint
pptapplication/vnd.ms-powerpoint
psapplication/postscript
pwzapplication/vnd.ms-powerpoint
qtvideo/quicktime
raaudio/x-pn-realaudio
ramaudio/x-pn-realaudio
rtftext/richtext
shapplication/x-shar
sndaudio/basic
splapplication/futuresplash
swfapplication/futuresplash
tarapplication/x-tar
texttext/plain
tifimage/tiff
tiffimage/tiff
txttext/plain
uuapplication/octet-stream
visapplication/vision-compressed
wavaudio/x-wav
waxaudio/x-ms-wax
wbmpimage/vnd.wap.wbmp
wmvideo/x-ms-wm
wmaaudio/x-ms-wma
wmdapplication/x-ms-wmd
wmltext/vnd.wap.wml
wmlstext/vnd.wap.wmlscript
wmvvideo/x-ms-wmv
wmxvideo/x-ms-wmx
wmzapplication/x-ms-wmz
wrlx-world/x-vrml
wvxvideo/x-ms-wvx
xlsapplication/vnd.ms-excel
xmltext/xml
zipapplication/x-zip-compressed

View/Modify Permissions for CleverPath Portal

Portal View
Permissions
Modify Keyword
Permissions Property Setting Code Number
PublicPublicPublicModify
511
PublicWorkgroupPublicViewGroupModify
509
PublicOwnerPublicView
493
WorkgroupWorkgroupGroupModify
504
WorkgroupOwnerGroupView
488
OwnerOwnerPersonalModify
448