Add Recipe Roles permission behavior, how to add media management to an ASP.NET Core app? - This week in Orchard (24/01/2025)

This week's topics are migrating the OpenID module to OpenIddict 6, adding Recipe Roles permission behavior, and we will mention our latest Orchard Nuggets post, where you can learn how to add media management to an ASP.NET Core app. Without further ado, let's dive in!

Orchard Core updates

Migrate the OpenID module to OpenIddict 6

This is about updating the OpenID module to use OpenIddict 6.0, which shipped in December. With OpenIddict 6.0 being now generally available, the previous version, OpenIddict 5.0, stops being supported and won't receive bug fixes or security updates. As such, it is recommended to migrate to OpenIddict 6.0 to continue receiving bug and security fixes. If you want to know more about the latest version of OpenIddict, check out this great post from Kévin Chalet!

OpenIddict 6

Add Recipe Roles permission behavior

Currently, we have RoleStep, which allows the user to create new roles. This step always removes all existing claims and loads only the claims you provide. This is a good step for introducing new roles. However, if the user wants to update the existing role permissions, they must list all the roles manually. It would be nice to add a property to the RoleStep to control the behavior of permission handling. For example, adding a property called PermissionBehavior when the value is Replace by default would mean we should replace permission as we do today. However, if a user sets it to Add, we could combine the permissions instead of removing existing ones.

As of version 3.0, the Roles recipe includes the ability to define specific permission behaviors, giving you greater control over how permissions are managed within a role. The following behaviors are available:

  • Replace: This behavior removes all existing permissions associated with the role and replaces them with the new permissions from the Permissions collection. This is the default behavior.
  • Add: This behavior adds the new permission(s) from the Permissions collection to the role, but only if they do not already exist. It does not affect the existing permissions.
  • Remove: This behavior removes the specified permission(s) in the Permissions collection from the role’s existing permissions.

For more info about the new PermissionBehavior, check out the documentation, which also contains an example of adding a new Permission to a Role.

Adding a new Permission to a Role

News from the community

How to add media management to an ASP.NET Core app? - Orchard Core Nuggets

Using media files, such as images, videos, and documents (like PDF files), is a common requirement for a modern website. Media can enhance user experience by making content more engaging, visually appealing, and/or easier to understand. Fortunately, Orchard Core has a built-in solution: the Orchard Core Media feature. As the description says in the official documentation: "The Media module provides a UI to upload and organize binary files that can be used while creating content."

Check out our latest Orchard Nuggets post to see how you can use the Media Library, the Media Field, the image shortcode, and many more!

How to add media management to an ASP.NET Core app

This post is part of our Orchard Core Nuggets series, where we answer common Orchard questions about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips, and let us know if you have another question!

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 460 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!

If you are interested in more news about Orchard and the details of the topics above, check out the recording of this Orchard meeting!