-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set-PnPGroupPermissions Case Sensitivity Inconsistency #1721
Comments
Hi @veronicageek, |
Hi @martinlingstuyl , welcome and please go ahead. Let me know if you need help, happy to do so :) |
Thanks! 👇 also: I think cloning the PnP-Sites-Core is no longer necessary anymore. Am I correct? |
Never mind. I found the script in |
Okay @gautamdsheth, this is the story: one commandlet uses a CSOM function, the other uses PnP Core SDK. The Core SDK uses an OData call and I'm not sure what the direction is this library is taking. Is it meant to be CSOM side by side with PnP Core SDK whichever one fits the requirements? Or is CSOM meant to be gradually replaced? What are the reasons why CSOM is sometimes picked over Core SDK for commandlets? Hope to hear from you on this. My idea would be to change Get-PnPGroup to use PnP Core SDK as well. In that case everything becomes case-sensitive and is using the modern SDK. |
I’d like to chime in here. Are group names case sensitive in Sharepoint Online? If not then the PS commands should not either for consistency sake. Having one be case sensitive and the other not is probably worse than the current case. My assumption is since the GET command is case insensitive then they are also case insensitive for SPO
… On Mar 31, 2022, at 12:48 PM, Martin Lingstuyl ***@***.***> wrote:
Okay @gautamdsheth, this is the story: one commandlet uses a CSOM function, the other uses PnP Core SDK. The Core SDK uses an OData call and $filter only supports case senstive. Hence the difference.
I'm not sure what the direction is this library is taking. Is it meant to be CSOM side by side with PnP Core SDK whichever one fits the requirements? Or is CSOM meant to be gradually replaced? What are the reasons why CSOM is sometimes picked over Core SDK for commandlets?
Hope to hear from you on this. My idea would be to change Get-PnPGroup to use PnP Core SDK as well. In that case everything becomes case-sensitive and is using the modern SDK.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
That's a good point @narbehm, SharePoint group names are case insensitive. But try to retrieve them using the REST Api ( |
@martinlingstuyl - thanks for investigating this, much appreciated ! I like the idea of replacing CSOM with PnP Core SDK, but that will be a breaking change and we cant do that unfortunately, at least not right now for 1.x versions. So, for now will have to keep using CSOM and PnP Core SDK side by side. For 2.0 version, no ETA , we plan to replace CSOM with PnP Core SDK or plain HTTP REST requests where possible and keep CSOM for where we don't have a supported endpoint. So, yes we do plan to replace CSOM gradually where possible eventually. There is no logic right now of picking CSOM over PnP Core, it is upto the developer who creates the commands. @narbehm - for your particular issue, maybe you can use the Id of the group itself ? I believe Get-PnPGroup will get you the Id and then use that in your Set-PnPGroupPermissions command ? |
Thanks for the explanation @gautamdsheth! If the general direction is PnP Core SDK and HTTP REST anyway, we might eventually run into this casing-issue for all commands that filter something by name or title... I think. But well, as we cannot really fix the SharePoint REST API... 😁 We could at least ensure that both commands do the same thing, get the group using Pnp Core SDK. What I could do is update Is that a good course of action? |
@martinlingstuyl - It will be a breaking change. PnP Core SDK returns its own objects and not the CSOM ones which are being returned currently. So, current scripts which rely on CSOM returned objects will break. Example:
|
I see! In that case there's nothing to be done for now I guess. The only alternative would be to query for all groups and filter clientside. Which is not exactly ideal in other respects. Although the amount of sitegroups is probably always more or less limited. If we $select only the title the amount of data crossing the wire is rather small...after which we can get the details of the one with a matching name. I'm not sure what you would think about such a solution. But I agree with @narbehm that this case sensitivity is rather unwanted. |
@martinlingstuyl , @narbehm : Sorry for responding a bit late, have been doing some thinking around this and I think I may have found a way. How about we change the
In this way, I think it would be a bit more accurate. Let me know what you think about this approach @martinlingstuyl :) |
hi @gautamdsheth |
Here’s an idea. With Set-PnPGroupOermissions, Remove the ability of using the group name as the identity. This will force the use of the group Id instead.
… On Apr 26, 2022, at 4:33 AM, Martin Lingstuyl ***@***.***> wrote:
hi @gautamdsheth
I agree that would make things more consistent. I would be happy to implement it.
It still might break some scripts though, as the Get-PnPGroup script will change from being case insensitive to case sensitive.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
hi @martinlingstuyl , go for it !! @narbehm - no can't do that, but we will fix the |
Ok @gautamdsheth, @narbehm , so I fixed it and created a pull request. This is my first pull request in this repo. I hope it meets the requirements! |
@narbehm am closing this issue since @martinlingstuyl fixed it. Now both The fix will be available in tomorrow's nightly and later on in a major release whenever that happens. |
Set-PnPGroupPermissions -Ideneity "Group Name" <- "Group Name" is expected to be case sensitive. However,
Get-PnPGroup -Identity "Group Name" <- "Group Name" is not expected to be case sensitive.
The issue comes about when you use Get-PnPGroup to check to see if a group exists before you use Set-PnPGroupPermissions to set its permissions. Since the later is case sensitive, it could fail even though logically the group exists.
The text was updated successfully, but these errors were encountered: