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

Improve multisite behavior #107

Merged
merged 8 commits into from
Apr 26, 2022
Merged

Improve multisite behavior #107

merged 8 commits into from
Apr 26, 2022

Conversation

akirk
Copy link
Owner

@akirk akirk commented Apr 15, 2022

This PR attempts to improve the plugin's behavior when running inside multisite environments.

Problem

The Friends plugin was designed for allowing unrelated sites across the web to communicate with each other and establish authentication against each other. They communicate via REST API and represent each other with locally created users. The content for the other sites is downloaded via feeds and assigned to these representative users with a custom post type friend_post_cache.

While this generally works in a multisite context, there are a few things that don't fit the environment well:

  • The super admin role has every permission on any site, even if it hasn't been assigned to it. This makes the plugins reliance on user roles fail (for example, it always has the "friend" capability even if it is not a friend of the site).
  • It is pointless to create a user to represent the other site, since that other user is on the same multisite (=database) already. This is not only for superflous redundancy reasons. Normally, there is a user created by deriving a username from the URL, but it two friends befriend the same person on the same blog, the same username is shared already resulting a clash. Thus we could equally well use the original user.
  • Sub-directory multisites are different once again for discovering if a user's URL resides on the local multisite environment.

Solution

This PR addresses the above in the following ways:

This has been hard to represent in unit tests but those covering the general behavior still work. I've done a lot of manual testing to ensure that this doesn't break existing flows.

Refs #96, #99.

@akirk akirk force-pushed the improve-multisite-behavior branch from eba39d9 to 1dc150e Compare April 15, 2022 13:02
@akirk akirk self-assigned this Apr 15, 2022
@akirk akirk merged commit ea6259a into main Apr 26, 2022
@akirk akirk deleted the improve-multisite-behavior branch April 26, 2022 14:35
@akirk akirk restored the improve-multisite-behavior branch September 16, 2023 07:48
@akirk akirk deleted the improve-multisite-behavior branch September 18, 2023 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant