Hello,
how can I check with JavaScript in the Plumsail Form if a user from People Picker has permissions for the item and if so - what kind of permissions (View, Edit, Complete etc.)
Are special rights required to determine this or any user accessing the form can obtain this information?
Thank you
Dear @Cumatale,
That's an interesting question. Technically, you can use the following code to get a bitwise combination of enumeration values that specifies a set of permissions:
pnp.sp.web.lists.getByTitle('Your List Name')
.items.getById(1).getUserEffectivePermissions(fd.field('Person Field Name').value.Key)
.then(function(results){
console.log(results);
});
It will look like this:
It's technically a set of flags from here - https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee556747(v=office.14)
You can use this, as shown in this example - https://sharepoint.stackexchange.com/questions/129309/how-to-get-permission-of-a-sharepoint-list-for-a-user-using-rest-api/129311
P.S. If you need any help further adjusting the code for your needs, write us at [email protected] - this will take time to test and check, so it will likely have to be a paid support request.
Hello,
this is the code in a button:
console.log("fd.field('Analist').value.Key=" + fd.field('Analist').value.Key);
pnp.sp.web.lists.getByTitle('http://intranet/procese/Lists/Change%20Request/AllItems.aspx')
.items.getById(2).getUserEffectivePermissions(fd.field('Analist').value.Key)
.then(function(results){
console.log(results);
});
And this is the console:
What did I do wrong?
Thank you!
Dear @Cumatale ,
Hmm, you use lists.getByTitle(), but instead of list title, you're using URL instead, why? There is no list with "http://intranet/procese/Lists/Change%20Request/AllItems.aspx"
title.
Try to replace it with pnp.sp.web.lists.getByTitle('Change Request')
If this list in on a different site, you first need to define the web.
It works, thank you. But how ca I determine the permissions of all users on this item? I tried the code below:
pnp.sp.web.lists.getByTitle('Change Request')
.items.getById(2).getUserEffectivePermissions()
.then(function(results){
console.log(results);
});
but it didn't work:
Thanks
@mnikitina or @Nikita_Kurguzov
I used your code like this.
var itemId = fd.itemId;
pnp.sp.web.lists.getByTitle('ChangeBP').items.getById(itemId).getCurrentUserEffectivePermissions().then(console.log);
Now I´m getting this:
I would like to forward the user at certain permissions. But I can't get any further from here. Would you have an idea how I can implement this? And how do I know what exactly High and Low stand for?
Dear @Sternchen,
It's a mask for all permissions of the current user - How to get permission levels for Files/Folders/Documents in Sharepoint using rest endpoints? - Stack Overflow