开发者

How to determine whether a user can modify personalizable property?

I have a web part with a property that has personalizable attribute on it. There's a button on the web part that changes that property state. The problem is that when there's a user with only Read permissions given to him, the property cannot be updated, because Sharepoint doesn't allow that (btw, such users are not allowed to swith to web part edit mode also).

So the question is the following: how do I determine whether a user can modify personalizable property value (so I can know when to hide that button)? I know I can iterate through his permissions and look for Read there, but I don't like this i开发者_开发百科dea for several reasons.

Sharepoint somehow knows if a user is allowed to edit web part (switch to edit mode) and I wonder if there's a property that can tell you if a user is allowed to edit a web part.

Thank you.


The Microsoft.SharePoint.WebPartPages.WebPart has a Permissions property that's type is an enum with only three values: AllProperties, PersonalProperties, and None. Try using that.

If you're using the .net WebPart object you can always cast it temporarily.


If you are looking for Read permission on a web or list try:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.doesuserhavepermissions.aspx

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.doesuserhavepermissions.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜