As an example, the below jQuery displays current SharePoint user title.
Is it possible to use the sp.js objects to test If the current user has Full Control on the current page or Site and send an alert if they do?
Many Thanks.
ar context; var web; var user; // This code runs when the DOM is ready. It ensures the SharePoint // script file sp.js is loaded and then executes sharePointReady() $(document).ready(function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady); }); // This function creates a context object which is needed to use the SharePoint object model function sharePointReady() { context = new SP.ClientContext.get_current(); web = context.get_web(); getUserName(); } // This function prepares, loads, and then executes a SharePoint query to get the current users information function getUserName() { user = web.get_currentUser(); context.load(user); context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail); } // This function is executed if the above call is successful // It replaces the contents of the 'helloString' element with the user name function onGetUserNameSuccess() { $('#message').text('Hello ' + user.get_title()); }
============================
Thank You
cyberpine.com