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

Enhances spo site set with ability to adding owner without having permissions, Closes #4600 #4861

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

nicodecleyre
Copy link
Contributor

Closes #4600

@milanholemans
Copy link
Contributor

Thank you @nicodecleyre! We'll review it ASAP!

Copy link
Contributor

@martinlingstuyl martinlingstuyl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, very nicely done! Let's fix some things before we merge..

@martinlingstuyl
Copy link
Contributor

Question @nicodecleyre: how does this perform in an environment with many sites? I'm asking myself if we should call the admin endpoint all the time or only if the regular endpoint fails.

@martinlingstuyl martinlingstuyl marked this pull request as draft June 11, 2023 18:07
@nicodecleyre
Copy link
Contributor Author

Question @nicodecleyre: how does this perform in an environment with many sites? I'm asking myself if we should call the admin endpoint all the time or only if the regular endpoint fails.

Don't know... I will take a look if i can test it on a tenant with 5000+ sites...

@nicodecleyre nicodecleyre marked this pull request as ready for review June 20, 2023 10:01
@nicodecleyre nicodecleyre marked this pull request as draft June 20, 2023 10:09
@martinlingstuyl
Copy link
Contributor

Hi @nicodecleyre,whats the status of this PR? Is it ready for review?

@nicodecleyre
Copy link
Contributor Author

Hi @nicodecleyre,whats the status of this PR? Is it ready for review?

Not yet, gonna test it with a tenant with 5000 sites next week

@nicodecleyre
Copy link
Contributor Author

Test looking good! (added some extra logging for this test) Let me know if you want me to test anything else
image

@nicodecleyre nicodecleyre marked this pull request as ready for review July 4, 2023 09:47
@martinlingstuyl
Copy link
Contributor

Test looking good! (added some extra logging for this test) Let me know if you want me to test anything else

image

How about speed of execution @nicodecleyre? How big was the tenant you tested this on and did you notice performance differences between the old and new way?

@martinlingstuyl
Copy link
Contributor

@nicodecleyre, did you have an answer on my question already?

@nicodecleyre
Copy link
Contributor Author

@nicodecleyre, did you have an answer on my question already?

sorry about that! Tested it on a tenant with 5050 site collections.
I don't notice any change in speed. Just the fact that the command works with the enhancement as seen below (see 2nd output, first output is as is)
image

@martinlingstuyl
Copy link
Contributor

Hi @nicodecleyre,
It's been a while since I've responded to this one.
Reason is I've been thinking about the setup.

Retrieving all tenant sites using the new endpoint has a few drawbacks: You appear to cannot retrieve OneDrive sites like we do with the other endpoint, plus its interface is different from the CSOM request we are normally doing.
And the siteId cannot be found on other endpoints. It's not ideal.

So I thought: why are we even retrieving the siteId. And it turns out we only use it in one place. On the UpdateGroupPropertiesBySiteId function. Well, it appears there's an alias function that does not need the siteId: UpdateGroupProperties.

The following request updates the site title just as well:

POST https://contoso-admin.sharepoint.com/_api/SPOGroup/UpdateGroupProperties
{
  groupId: this.groupId,
  displayName: args.options.title
}

So I suggest we change it up a bit:

  • Use the getSiteGroupId function in site-remove.ts to get the group ID through the admin endpoint
  • Update to using the UpdateGroupProperties function.

Together this should be enough, and we can remove the getTenantSites util and implementation entirely. The change will be quite small.

Could you update the PR with this implementation? Thanks again for all the work!

@martinlingstuyl martinlingstuyl marked this pull request as draft September 6, 2023 19:48
@martinlingstuyl
Copy link
Contributor

Hi @nicodecleyre, how r u doing on this? Just checking 😀

@nicodecleyre
Copy link
Contributor Author

nicodecleyre commented Sep 24, 2023

Hi @martinlingstuyl,

Did the changes as asked. If i'm not mistaken we still have to use getTenantSites to get the groupId. Or do I see this wrong and do you want to revert this to the usage of /_api/site?$select=GroupId?

@nicodecleyre nicodecleyre marked this pull request as ready for review September 24, 2023 10:24
@martinlingstuyl
Copy link
Contributor

Hi @nicodecleyre,
Nice, you've been busy!

About your question: You're right, we still need the groupId. but I'd like us to get it using the list on the admin site: DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS, checkout hubsite get for example.

This seems to me more straightforward than using RenderAdminListData after all. For one we can use an odata $filter `SiteUrl eq '', and also we can reuse code.

Now you've been building this util in another PR. I suggest we wait a bit for a conclusion on the discussion there as to how we're going to handle the util PR's.

@martinlingstuyl
Copy link
Contributor

Waiting on the conclusion here

@martinlingstuyl martinlingstuyl marked this pull request as draft September 25, 2023 14:23
@mkm17
Copy link
Contributor

mkm17 commented Sep 20, 2024

Hi @nicodecleyre @martinlingstuyl , I see this long discussion here, and I was wondering if the issue mentioned in the topic of this PR has already been resolved with the spo site admin add --asAdmin --primary command.

I noticed there were some doubts about using the admin endpoint (the https://contoso-admin.sharepoint.com/_api/SPO.Tenant/ endpoint is used in site admin add). Is there something I should reconsider in this command?

@martinlingstuyl
Copy link
Contributor

Hi @mkm17, That command does make this PR less urgent, yes...

I don't think I had doubts about using admin endpoints, but more about what endpoint to use so that it covers all types of sites (onedrives, regular sites, group sites) and where the group Id might be found if needed.

@mkm17
Copy link
Contributor

mkm17 commented Sep 20, 2024

@martinlingstuyl ok, thank you for confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug report: Cannot add an owner to a site if I don't have access to the site already
4 participants