pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
909 stars 317 forks source link

New command: m365 spe container permission add #6159

Open Adam-it opened 2 months ago

Adam-it commented 2 months ago

Usage

m365 spe container permission add [options]

Description

Adds permission to SharePoint Embedded Container for a specified user

Options

Option Description
-i, --containerId <containerId> ID of a SharePoint Embedded container.
-r, --roles <roles> Comma separated list of permissions. Possible values are reader, writer, manager, owner.
--userName [userName] The upn/email of user to assign role to. Use either userName or userId but not both.
--userId [userId] The id of user to assign role to. Use either userName or userId but not both.

Examples

Adds a reader role for the specified user to the container

m365 spe container permission add --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z"  --roles "reader" --userName "jacob@fabrikam.com"

Adds a multiple roles for the specified user to the container

m365 spe container permission add --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z"  --roles "reader,writer" --userName "jacob@fabrikam.com"

Default properties

No response

Additional Info

we may use the following API for that: https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-post-permissions?view=graph-rest-1.0&tabs=http

Jwaegebaert commented 2 months ago

One improvement could be adding another example, maybe one with multiple roles. We could also add userId, so they can set permissions using the user Entra ID.

milanholemans commented 2 months ago

I think upn should also be renamed to userName to be consistent with other commands.

Adam-it commented 2 months ago

I think upn should also be renamed to userName to be consistent with other commands.

updated ✅

One improvement could be adding another example, maybe one with multiple roles. We could also add userId, so they can set permissions using the user Entra ID.

Added additional example ✅ Improved a bit description ✅ and the description of the container ID ✅ Good call with the userId. added ✅

Adam-it commented 2 months ago

@pnp/cli-for-microsoft-365-maintainers any other feed or should we open it up?

milanholemans commented 2 months ago

Made a few small remaining changes. LGTM!