Upgrade GraphQL to 8, Christmas in Lombiq - This week in Orchard (20/12/2024)
Our last post of this year concerns upgrading GraphQL to 8 and preventing external users registration. We would like to share some photos of our Christmas event. Thank you all for reading our posts and for making the Orchard community stronger!
Orchard Core updates
Upgrade GraphQL to 8
We currently use 7.9.0 of the GraphQL packages. However, as of now, 8 is out, so we needed to upgrade. The goal here was to upgrade to the latest GraphQL packages. This is a breaking change and will not be part of 2.x. It will be included in Orchard Core 3.0 since it's breaking (as we have to set ResolvedType instead of Type on all fields, including custom fields in external projects). Below are important changes and considerations for your future implementation:
1. Removal of Default Implementation: The IContentTypeBuilder interface previously included a default implementation for the Clear() method. This implementation has been removed. If you have a custom implementation of IContentTypeBuilder, you must now provide your own Clear() method. The method can remain empty if no specific actions are needed.
2. Sealed Classes: Several classes have been marked as sealed to prevent further inheritance. This change is intended to enhance stability and maintainability. The following classes are now sealed:
- All implementations of InputObjectGraphType.
- All implementations of ObjectGraphType<>.
- All implementations of WhereInputObjectGraphType.
- All implementations of DynamicContentTypeBuilder.
- All implementations of IContentTypeBuilder.
- All implementations of GraphQLFilter.
- All implementations of ISchemaBuilder.
Prevent External Users Registration
When using the external authentication feature, users logging in from external providers still create a new account even when the setting DisableNewRegistrations is true. This means that if you enable any external authentication provider feature and set DisableNewRegistrations to true in the External Authentication settings, users can log in using the external provider. The fix is that users should not be able to register if DisableNewRegistrations is set to true.
Furthermore, when a user logs in from an external provider but fails to create an account, we redirect them back to the login page. But if the Use external provider for login settings is set, the user will be caught in an infinite loop redirecting back and forth. This change also fixes the fact that, in this case, the External Authentication Feature is causing endless redirection.
Apart from the fixes, here we also introduced some improvements. From Orchard Core 3.0, the user registration and login functionalities have been refactored for better extensibility:
- Registration Improvements: The IRegistrationFormEvents interface now includes Task RegisteringAsync(UserRegisteringContext context) for streamlined customization. A new base class, RegistrationFormEventsBase, allows developers to override only necessary methods.
- Login Improvements: The ILoginFormEvent interface has a new method: Task<IActionResult> ValidatingLoginAsync(IUser user). The LoginFormEventBase class enables overriding relevant methods. Note that the base implementation of LoggingInAsync() has been removed; you must now implement this method if using LoginFormEventBase.
- User Service Update: A new method in IUserService interface: Task<IUser> RegisterAsync(RegisterUserForm model, Action<string, string> reportError) facilitates registration with error reporting.
These enhancements make the user management system more modular and customizable.
News from the community
Christmas in Lombiq
Sometimes we do stuff. Together. Not (just) in front of computer screens. These are some usual events in Lombiq that are all announced and arranged in advance. At the end of every year, we have an event called RnDay: this is a few hour-long event where we share what we recently worked on and plan to do. For example, if we recently finished a project, then the project's team members demo what they've done. We had our RnDay for this year in the Loffice, a coworking and event space where we held this event. And at the end of the day, we visited a nearby restaurant to have dinner together.
Thank you for reading our posts and strengthening the Orchard community with us! We hope to give you valuable news and demos about the happenings around Orchard and Orchard Core occasionally by reading our posts and, of course, the This Week in Orchard newsletter. We wish everyone a Merry Christmas with some photos of our latest event!
Orchard Dojo Newsletter
Lombiq's Orchard Dojo Newsletter has 466 subscribers! We started this newsletter to inform the Orchard community about the latest platform news. By subscribing, you will receive an email whenever a new post is published in Orchard Dojo, including This week in Orchard Posts.
Do you know other Orchard enthusiasts who want to read our weekly articles? Tell them to subscribe here!