This week in Orchard - 12/07/2018

Gábor Domonkos's avatar
This week in Orchard

Let's have a recap about the demos of the new editor for the Media Field and the working of how to authenticate users with Microsoft Account. Don't forget to check the issues left for the Beta 3 release!

On Orchard Core

Render property in GraphQL to render content items

We can use GraphQL to render a content item. The way it works is the following:

blogPost {
   render(layout: false, displayType: summary),
   autoroute { path }

Now you can call render, and the result of render will be the HTML of rendering this blog post including the layout. The community intend to add features like passing false value for the layout, in this case we do not have layout. Or displayType to render as a summary.

We can get the display URL of the blog post by using displayUrl. By having that we can do some static site generation even with or without a full CMS, because from the client script (that could be a mobile application as well) you will be able to ask all the blog post and render it. It will need more things and more processors, but that the start to have this kind of support.

You can find this feature in the render branch.

Issues left for the Beta 3 release

The community wants to schedule Beta 3 with .NET Core 2.2, that has now shipped. Now the community should focus on fixing the P0 and P1 issues and the ones that are marked with the beta3 milestone.

After they have been closed, Beta 3 will be shippable. Feel free to pick one and help the community to release Beta 3 sooner!


New editor for the Media Field

The idea is to add a new editor for the Media Field to solve a special use case to manage your media/content item. The assets will isolated in the navigation, so you don't see them in there, they are only editable from the content item.

If you add a new Media Field to your content type, you can choose to have a Limited: No media browser (will have a new name) editor type.

Normally when you create a new content item from a type that has a Media Field attached, you can browse media items from the Media Library. In the limited one, you can just upload one from your file system and Orchard takes care of the handling the files that you upload.

It means these files have a path (that consist of the segments of the content item ID) like in the image below to do not hit the limit the number of the files in a specific folder, and only users who have the right permission can manage these files through the Assets.

This feature is still under development, so will might change and improve in the future.

Authenticate with Microsoft Account

Head to the Microsoft Registration Portal and register a new application.

We must add a new platform here, let's choose Web option and enter the URL that the middleware will listen to. It could be the default Orchard Core HTTPS URL with the default callback path: https://localhost:44300/t1/signin-microsoft.

We also need to generate password by clicking on the Generate New Password button.

Go back to our admin portal and enable the Users Registration (if you want to add a new user) and Microsoft Account Authentication modules.

Then head to the Microsoft Authentication -> Microsoft Account menu to add the AppId and the Secret Key from the Microsoft Registration Portal.

Now in the login screen you will see a new option to Use another service to log in.

If you click on the Microsoft Account button, you can enter the credentials of your Microsoft Account. After you need to let this app to access your info.

If you click on the Yes button, you will see the Create a new account screen, where the Username and Email boxes are filled with the credentials of your Microsoft Account.

Here you need to register, because there is no name in the claims that we could retrieve the proposed username.

Now if you log off with this user and go to the admin panel you will see that the user has been created and it's on the list.

You can also authenticate users with their Azure Active Directory Account by enabling the Microsoft Azure Active Directory Authentication module.

You can fill the form based on the parameters of your Azure AD App registration under the Microsoft Authentication -> Azure Active Directory option.

Now you can log in using the External Logins option from Orchard the same as we did before.

You can read more about how the Microsoft Authentication works in Read The Docs!

For the full demos don't forget to watch the recording of the current podcast!

No Comments

Add a Comment