views:

60

answers:

1

Hello. I`d like to know which properties/functions must have which privileges to be used. Is there such a list?

For example, when developing code, how can a newbie know which properties or functions will work for site members, visitors or owners?

I`v been developing for a while, but still stumble at this one.

Thank you.

A: 

It's not so much about properties and functions. It is really for any time you are trying to execute a bit of code that the current user would not ordinarily have permission to run. For example, say you wanted to create a subsite based on some user-provided info when the user adds an item to a list. The user doesn't have privs to explicitly create such a site on his own. In a list item event receiver you would use a RunWithElevatedPrivileges block to create this subsite. That way the site gets created as the application pool owner rather than as the logged-in user, and you avoid the security issue. Of course, you will want to be careful what you do in such a block.

Chris Farmer
However, Properties like SPSite.AllWebs does need elevated privileges to be run. That's what i`m curious about - who has permissions to enumerate ALL webs? Probably those with manageweb permission, because regular users wouldn't have access to all webs? That's the way it works?
Janis Veinbergs