最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sharepoint - Elevated privileges in javascript - Stack Overflow

programmeradmin1浏览0评论

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_current();
context.executeQueryAsync(); // NEED PRIVILEGES TO WORK

Is this possible?

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_current();
context.executeQueryAsync(); // NEED PRIVILEGES TO WORK

Is this possible?

Share Improve this question edited Jun 16, 2015 at 13:27 William 4139 silver badges21 bronze badges asked May 17, 2011 at 9:38 Dr. NoDr. No 1,3365 gold badges28 silver badges57 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

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)

  1. 暂无评论