pnp / cli-microsoft365

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

New command: m365 spe container permission list #6162

Open Adam-it opened 1 month ago

Adam-it commented 1 month ago

Usage

m365 spe container permission list [options]

Description

Lists permissions of a SharePoint Embedded Container

Options

Option Description
-i, --containerId <id> The ID of the SharePoint Embedded Container

Examples

Lists Container permissions

m365 spe container permission list --containerId "b!ISJs1WRro0y0EWgkUYcktDa0mE8zSlFEqFzqRn70Zwp1CEtDEBZgQICPkRbil_5Z" 

Default properties

Additional Info

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

since the response is a complex object like

"value": [
    {
        "@odata.type": "#microsoft.graph.permission",
        "id": "cmVhZGVyX2k6MCMuZnxtZW1iZXJzaGlwfHJvcnlicjExMUBvdXRsb29rLmNvbQ",
        "roles": ["principalOwner"],
        "grantedToV2": {
          "user": {
            "id": "71392b2f-1765-406e-86af-5907d9bdb2ab",
            "userPrincipalName": "jhan@contoso.com",
            "displayName": "Jacob Hancock",
            "email": "jhan@contoso.com"
          }
        }
    },
    {
        "@odata.type": "#microsoft.graph.permission",
        "id": "cHJpbmNpcGFsT3duZXJfaTowIy5mfG1lbWJlcnNoaXB8ZGxpZGRlbGwyMDIyQG91dGxvb2suY29t",
        "roles": ["reader"],
        "grantedToV2": {
          "user": {
            "id": "86503198-b81b-43fe-81ee-ad45b8848ac9",
            "userPrincipalName": "mnick@contoso.com",
            "displayName": "Mark Nickhols",
            "email": "mnick@contoso.com"
          }
        }
    }

we will need to extract/modify it for to fit the format of the default response. We will need return roles as a comma separated list and extract the userPrincipalName from the user object

milanholemans commented 1 month ago

Hi @Adam-it, my remarks:

Adam-it commented 1 month ago

Hi @Adam-it, my remarks:

  • As description, I'd use Lists permissions of a Container
  • As description of the option id, maybe instead of a word, a short sentence: The ID of the SharePoint Embedded Container.
  • I see roles as default property. Since this is a list, do we have to format it to a comma-separated list?

good comments @milanholemans 👏 I updated the spec. Check it out. @pnp/cli-for-microsoft-365-maintainers any other comment before I open it up?

Jwaegebaert commented 1 month ago

LGTM!