Using Client Object model Check if user has Permission to an Item

A very interesting scenario came up last week when i wanted to restrict a user from opening a document when they don't have access to it. We were actually parsing a RSS feed from a document library and displaying docs in a custom webpart. Some of the users who do not have access to some of the doc where not only seeing the docs but were getting an Access denied page when they click on it. To avoid all that we decided to check for user's access on fly using the JavaScript Client object model and we would either hide it or give user a JavaScript alert popup for not having access to it.

Well the simple method that we were looking for was currentItem.get_effectiveBasePermissions();

this method will give access for the current user on the selected list item

big thanks to this Forum Post for pointing us to the right direction.

0 comments:

Post a Comment

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at sharepointprogrammingblogger@gmail.com .

Copyright (c) 2010 @ myshaepointwork.blogspot.com. All rights are reserved.Do Not Copy.

@ Learning SharePoint.com