Skip to content
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

Feature request : Add the capability to approve permission requests like m365 cli m365 spo serviceprincipal permissionrequest approve #1096

Closed
jansenbe opened this issue Feb 10, 2023 · 11 comments
Assignees
Labels
area:admin 📜 Admin library related help wanted Extra attention is needed

Comments

@jansenbe
Copy link
Contributor

          Feature request :

Add the capability to approve permission requests like m365 cli
m365 spo serviceprincipal permissionrequest approve

We are able to use pnpcore to deploy SPFx app to app catalog. However, the app request permission to call Graph API.
The only step we couldn't automate is the permission requests approval step.

Originally posted by @larry-lau in #897 (comment)

@jansenbe jansenbe added help wanted Extra attention is needed area:admin 📜 Admin library related labels Feb 10, 2023
@mloitzl
Copy link
Contributor

mloitzl commented Feb 11, 2023

@jansenbe I had a quick look at it.

  • The CSOM queries could be taken straight from the m365 cli project
  • I am not quite sure where this should go... - I reckon somewhere in PnP.Core.Admin, but this would need a new Model... probably ServicePrincipal or SPOServicePrincipal and at least some functionality for PermissionRequests list, approve and deny? I never extended model before...

@jansenbe
Copy link
Contributor Author

@mloitzl : yes, this would require a new model in PnP.Core.Admin, think that's the easiest and most reusable approach. Regarding the CSOM queries: in cli they are quite hardcoded, in PnP Core SDK we use a different model, one that allows to batch CSOM queries. If there's no REST/Graph equivalent for the API calls then CSOM has to be used by using our model. See https://github.com/pnp/pnpcore/tree/dev/src/sdk/PnP.Core.Admin/Services/Core/CSOM/Requests/Tenant for some sample CSOM operations.

@mloitzl
Copy link
Contributor

mloitzl commented Feb 17, 2023

@jansenbe Didn't have that much time this week... but here's a draft
#1100

@jansenbe
Copy link
Contributor Author

@mloitzl : awesome! Thanks for helping out 💪🚀Will review the PR early next week.

@jansenbe
Copy link
Contributor Author

@mloitzl : just reviewed and merged your PR, great job! Thanks a lot for your contribution to PnP Core SDK!!!

@larry-lau: please try this feature with the next nightly release (version 1.8.107 or higher). See https://pnp.github.io/pnpcore/using-the-sdk/admin-sharepoint-apps.html#list-approve-or-reject-the-permissions-requests-for-an-app for the docs.

Will close this issue now, please create new issue if things are not working @larry-lau, thank you @mloitzl for building the feature.

@larry-lau
Copy link

Thank you for implementing the feature so quickly. However, the ServicePrincipal class is internal so I am not able to instantiate.

@mloitzl
Copy link
Contributor

mloitzl commented Feb 25, 2023

Oops... that's a very obvious one 😆
I'll come up with a fix during the weekend

@jansenbe
Copy link
Contributor Author

@larry-lau : thanks for spotting that one @larry-lau and thanks for the fix @mloitzl . Our test project can see the internals of PNP Core SDK, hence this passed our checks.

@larry-lau
Copy link

Thanks! Which nightly build would have the new getter on IAppManager so I can test this out?

@jansenbe
Copy link
Contributor Author

The one out now

@larry-lau
Copy link

I have tested the API. Looking good. I would suggest renaming IPermissionRequest.PackageApproverName to RequesterName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:admin 📜 Admin library related help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants