cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

New command: 🔐 spo file roleinheritance reset

Open Adam-it opened this issue 2 years ago • 10 comments

Usage

m365 spo file roleinheritance reset [options]

Description

Restores the role inheritance of file

Options

Option Description
-u, --webUrl <webUrl> URL of the site where the file for which to reset role inheritance is located
--fileUrl [fileUrl] The server-relative URL of the file to retrieve. Specify either file url or file id but not both
-i, --fileId [fileId] The UniqueId (GUID) of the file to retrieve. Specify either file url or file id but not both
--confirm Don't prompt for confirmation

Examples

Reset inheritance of file with id (UniqueId) b2307a39-e878-458b-bc90-03bc578531d6 located in site https://contoso.sharepoint.com/sites/project-x

m365 spo file roleinheritance reset --webUrl "https://contoso.sharepoint.com/sites/project-x" --fileId "b2307a39-e878-458b-bc90-03bc578531d6" 

Reset inheritance of file with server-relative url /sites/project-x/documents/Test1.docx located in site https://contoso.sharepoint.com/sites/project-x

m365 spo file roleinheritance reset --webUrl "https://contoso.sharepoint.com/sites/project-x" --fileUrl "/sites/project-x/documents/Test1.docx"

Additional Info

I suggest we use Cli.executeCommandWithOutput and in the command implementation reuse the m365 spo listitem roleinheritance reset command which will also work in this case but we just need to pass the listItem Id. So the command should handle getting the correct file list item id by passed fileId or fileUrl and execute the listeItem roleinheritance reset command 👍

Adam-it avatar Aug 20 '22 14:08 Adam-it

@pnp/cli-for-microsoft-365-maintainers similar case for the reset. Any comments on this one?

Adam-it avatar Aug 20 '22 14:08 Adam-it

Looks great @Adam-it!

martinlingstuyl avatar Aug 20 '22 15:08 martinlingstuyl

Could you add an extra example of how the list options are used? And some extra comment on how those options are only applicable when using fileId?

martinlingstuyl avatar Aug 20 '22 15:08 martinlingstuyl

Let's update descriptions for fileId and fileUrl to be explicit which ID and URL we're referring to.

waldekmastykarz avatar Aug 20 '22 17:08 waldekmastykarz

@waldekmastykarz I updated the spec @martinlingstuyl I actually made a mistake 😉. We don't need list information. File Unique Id or ServerRelativeUrl is enough to get the file

Adam-it avatar Aug 20 '22 19:08 Adam-it

That's awesome @Adam-it!

martinlingstuyl avatar Aug 20 '22 20:08 martinlingstuyl

Can I work on this?

nanddeepn avatar Aug 21 '22 10:08 nanddeepn

Can I work on this?

Yes totally 👍. Thank you, you rock 🤩

Adam-it avatar Aug 21 '22 10:08 Adam-it

@nanddeepn along the way we agreed internally that all roleinheritance reset/break should have --confim option and if not use should prompt the user to confirm this operation. Very similar to what we use in remove commands. I updated the spec. Please consider it as well during you development

Adam-it avatar Sep 08 '22 09:09 Adam-it

Thanks @Adam-it

nanddeepn avatar Sep 08 '22 18:09 nanddeepn