In the webpart where you want to provide security, please change the type of
content to 'VB Script' and add the following in the Embedded content field.
--------------------------------------------------------------------------------\
-----------------------------------------
Function Init(node)
On Error Resume Next
Dim nodPartStorage
Set nodPartStorage = node.selectSingleNode("PartStorage")
If Err.Number <> 0 Then ClearCurrentErrorContext() : Exit Function
If Not IsObject(nodPartStorage) Then Exit Function
If nodPartStorage Is Nothing Then Exit Function
Dim strPartStorage
strPartStorage = CStr(nodPartStorage.nodeTypedValue)
If Err.Number <> 0 Then ClearCurrentErrorContext()
If Len(strPartStorage) <= 0 Then Exit Function
Dim iPrevLF, iLF, strFolderPath, strOrderByPropertyNameAndDirection,
cRecordsToDisplay
strPartStorage = Replace(strPartStorage, vbCR, "")
iPrevLF = 0
iLF = InStr(strPartStorage, vbLF)
If iLF <= 0 Then
strFolderPath = strPartStorage
strOrderByPropertyNameAndDirection = Empty
cRecordsToDisplay = 0
Else
strFolderPath = Mid(strPartStorage, 1, iLF - 1)
iPrevLF = iLF
iLF = InStr(iLF + 1, strPartStorage, vbLF)
If iLF <= 0 Then
strOrderByPropertyNameAndDirection = Mid(strPartStorage, iLF + 1)
cRecordsToDisplay = 0
Else
strOrderByPropertyNameAndDirection = Mid(strPartStorage, iPrevLF + 1, iLF -
iPrevLF - 1)
cRecordsToDisplay = CLng(Mid(strPartStorage, iLF + 1))
End If
End IF
strFolderPath = Replace(strFolderPath, "PORTAL_NEWS_FOLDER_PATH_HOLDER", "/"
& GetWorkspacePropertyByUri(g_cdostrURI_NewsFolder))
strFolderPath = Replace(strFolderPath,
"PORTAL_ANNOUNCEMENTS_FOLDER_PATH_HOLDER", "/" &
GetWorkspacePropertyByUri(g_cdostrURI_AnnouncementsFolder))
strFolderPath = Replace(strFolderPath,
"PORTAL_QUICKLINKS_FOLDER_PATH_HOLDER", "/" &
GetWorkspacePropertyByUri(g_cdostrURI_QuickLinksFolder))
Dim strOrderByFragment
If Len(strOrderByPropertyNameAndDirection) > 0 Then
strOrderByFragment = "ORDER BY " & vbCRLF & " " &
strOrderByPropertyNameAndDirection
End If
Dim hq
Set hq = New CHttpQuery
If Err.Number <> 0 Then SaveCurrentErrorContext "Init() - Error
instantiating CHttpQuery object." : Exit Function
hq.IsAsync = g_fUseAsyncMode
If Err.Number <> 0 Then SaveCurrentErrorContext "Init() - Error setting the
query to be async." : Exit Function
hq.StartSearchQuery "SELECT " & vbCRLF & _
" ""DAV:href"", " & vbCRLF & _
" ""DAV:displayname"", " & vbCRLF & _
" ""DAV:getlastmodified"", " & vbCRLF & _
" ""urn:schemas-microsoft-com:office:office#Description"", " &
vbCRLF & _
" ""urn:schemas-microsoft-com:publishing:ShortcutTarget"", " &
vbCRLF & _
" ""urn:schemas-microsoft-com:office:office#Title"" " & vbCRLF & _
"FROM " & vbCRLF & _
" SCOPE('SHALLOW TRAVERSAL OF ""/" & GetWorkspaceName() &
strFolderPath & """')" & vbCRLF & _
strOrderByFragment, 0, cRecordsToDisplay - 1, -1, True
If Err.Number <> 0 Then SaveCurrentErrorContext "Init() - Error starting
query for folder """ & strFolderPath & """" : Exit Function
SetPerPageCachedItem node.SelectSingleNode("Title").text & "-QueryObject",
hq
If Err.Number <> 0 Then SaveCurrentErrorContext "Init() - Error saving query
object in per-page cache." : Exit Function
End Function
Function GetContent(node)
On Error Resume Next
Dim boolIsCoordinator
Dim boolIsAuthor
boolIsAuthor = TestRights(ReadParameterFromGetOrPost("DataUrl"), 2)
boolIsCoordinator = TestRights(ReadParameterFromGetOrPost("DataUrl"), 4)
If not (boolIsCoordinator or boolIsAuthor) Then
node.SelectSingleNode("IsIncluded").Text = "0"
Exit Function
End If
GetContent = " "
Dim hq
Set hq = GetPerPageCachedItem(node.SelectSingleNode("Title").text &
"-QueryObject")
If Err.Number <> 0 Then SaveCurrentErrorContext "GetContent() - Error
getting query object that was saved in per-page cache." : Exit Function
If Not IsObject(hq) Then Exit Function
If hq Is Nothing Then Exit Function
hq.WaitForQueryCompletion
If Err.Number <> 0 Then SaveCurrentErrorContext "GetContent() - Error
blocking until query object has all results." : Exit Function
Dim strXmlResults
strXmlResults = hq.QueryResults
If Err.Number <> 0 Then SaveCurrentErrorContext "GetContent() - Error
getting query results from query object." : Exit Function
GetContent = InsertXmlContextValues(TahoeXmlFixup(strXmlResults), _
"<LocStringForNone>" & L_StartPagePartHasNoContents_TEXT &
"</LocStringForNone>")
If Err.Number <> 0 Then SaveCurrentErrorContext "GetContent() - Error
munging XML result set." : Exit Function
End Function
--------------------------------------------------------------------------------\
-----------------------------------------
This will provide access only to Coordinators and Authors. Following are the
constants for different access levels
Const ACCESS_NONE = "0"
Const ACCESS_READ = "1"
Const ACCESS_AUTHOR = "2"
Const ACCESS_EDITOR = "3"
Const ACCESS_OWNER = "4"
Please make sure these are set in the GET Content function