开发者

Elevated privileges in javascript

In SharePoint, when I need to execute an action when the user doesn't have privileges to do so, I use:

SPSecurity.RunWithElevatedPrivileges(delegate() 
 {
// DO SOMETHING WITH PRIVILEGES 
});

But now I need to execute JavaScript with elevated privileges:

var context = new SP.ClientContext.get_cur开发者_Go百科rent();
context.executeQueryAsync(); // NEED PRIVILEGES TO WORK

Is this possible?


No, that isn't possible.

The user would be able to manipulate the JavaScript which would open a huge security gap. You just can do this on the server-side. If you need something like this it must all take place at the server.


Agreed that you can't do this from JavaScript and it would be foolish if you could. One scenario that could help you is to look into Designer no-code workflows. New in SP2010 is the ability to have chunks of the workflow execute as the person who designed the workflow rather than the person who has started the workflow instance. This could be used to get around your permissions problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜