Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Webpart securities

  Asked By: Amalraj    Date: Jan 07    Category: Sharepoint    Views: 606

i'm fairly new to SPS and am hoping if u can assist me in
this lil problem i'm having.

I've created a dashboard entitled Telephone list. In Telephone List
there should be two webparts: Search and Admin. Now essentially what
i want is that only certain ppl (authors) have permissions to view
the Admin Wepart. For those that dont (readers), they only view the
Search Webpart and the Admin remains hidden. So instead of readers
seeing a "Add Content to Your Digital Dashboard" page, they should
just see the Search Webpart, and the Authors when going into the
Telephone List, they should see Admin Webpart and not the Search
Webpart. if you know what i mean,

I have set the security settings in the weparts and added denials to
certain ppl howeva they still see the full Admin webpart and such.
Would there be any other way of doing this or can this not be done?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Nisarg Kapadia     Answered On: Jan 07

By-default the readers, will not see the "Add Content to Your Digital
Dashboard", this option is only available to the coordinators.

You have indeed followed a right procedure, in restricting the users from seeing
the webpart. That should deny the user from seeing the webpart. I have done many
of that sort. Make sure the rights assigning to a group and to individual. I
guess there is a little block, that can be sorted.

 
Answer #2    Answered By: Jaferry Khan     Answered On: Jan 07

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

 
Didn't find what you were looking for? Find more on Webpart securities Or get search suggestion and latest updates.




Tagged: