Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ctx = new SP.ClientContext.get_current();
- var web = context.get_web();
- var ob = new SP.BasePermissions();
- ob.set(SP.PermissionKind.addAndCustomizePages)
- var per = web.doesUserHavePermissions(ob)
- ctx.executeQueryAsync(
- function(){
- alert(per.get_value()); // true if user has permission
- },
- function(a,b){
- alert ("Something wrong");
- }
- );
- this.context.pageContext.listItem.permissions
- this.context.pageContext.web.permissions
- tsd install microsoft.ajax
- tsd install sharepoint
- {
- "sp-init": {
- "path": "https://tenantname.sharepoint.com/_layouts/15/init.js",
- "globalName": "$_global_init"
- },
- "microsoft-ajax": {
- "path": "https://tenantname.sharepoint.com/_layouts/15/MicrosoftAjax.js",
- "globalName": "Sys",
- "globalDependencies": [ "sp-init" ]
- },
- "sp-runtime": {
- "path": "https://tenantname.sharepoint.com/_layouts/15/SP.Runtime.js",
- "globalName": "SP",
- "globalDependencies": [ "microsoft-ajax" ]
- },
- "sharepoint": {
- "path": "https://tenantname.sharepoint.com/_layouts/15/SP.js",
- "globalName": "SP",
- "globalDependencies": [ "sp-runtime" ]
- }
- }
- require('sp-init');
- require('microsoft-ajax');
- require('sp-runtime');
- require('sharepoint');
- https://<site url>/_api/web/doesuserhavepermissions(@v)?@v={'High':'0', 'Low':'262144'}
- requirejs.config({ enforceDefine: false });
- var requireQueue = function (modules, callback) {
- function load(queue, results) {
- if (queue.length) {
- require([queue.shift()], function (result) {
- results.push(result);
- load(queue, results);
- });
- } else {
- callback.apply(null, results);
- }
- }
- load(modules, []);
- };
- requireQueue([
- '/_layouts/15/init.js',
- '/_layouts/15/MicrosoftAjax.js',
- '/_layouts/15/SP.Runtime.js',
- '/_layouts/15/SP.js'
- ], function () {
- // JSOM is loaded
- });
Add Comment
Please, Sign In to add comment