Add a way to Remove User from a Role, Lombiq Hosting - Tenants Email Quota Management - This week in Orchard (15/12/2023)

Gábor Domonkos's avatar
Multi-tenancy, Content management, This week in Orchard, Workflows

New Get users by roles and Unassign users from roles activities, add async methods to ContentDefinitionManager to prevent possible thread starvation, and a demo about Lombiq's Tenants Email Quota Management module! Let's get started!

Orchard Core updates

Add a way to Remove a User from a Role

This change introduces two new activities that you can utilize when working with workflows.

The first one is called Get users by roles. Here you can easily choose the roles to identify users by using the Roles check boxes. You can see that you can provide a key (Output Key Name) that will be used to store the user's ID in a list that you can use in an upcoming activity in your workflow.

Get Users by Role Task

The second activity is the Unassign user from roles one. The Roles check box works the same and the UserName text box can be used to provide the user name of the user who you want to update. Here in this silly example, we hard-coded the admin user name but of course, you can use Liquid to have a flexible activity.

Unassign User Role Task

Add Async method to ContentDefinitionManager to prevent possible thread starvation

The idea here is to make all the IContentDefinitionManager methods async to prevent possible thread starvation. To avoid a breaking change, the old ones were marked as obsolete.

Here is a list of interfaces that were modified:

  • IStereotypeService
  • IStereotypesProvider
  • IRouteableContentTypeProvider
  • IRouteableContentTypeCoordinator
  • IContentDefinitionService
  • IContentDefinitionManager
  • IContentDefinitionService

On this screen, you can see the updated IContentDefinitionManager interface, where the non-async methods were marked as obsolete with a warning message that these methods will be removed in the upcoming releases. So, when you update your solution to the latest Orchard Core version, don't be surprised when you see some warnings after you build your solution.

Async methods in IContentDefinitionManager


Lombiq Hosting - Tenants Email Quota Management

This demo will be about a new Orchard Core module, part of our Hosting Tenants repository, that helps you manage email quotas. Hence the name Email quota management, which could be useful if you have a SaaS provider (like our SaaS provider, DotNest) and you would like to restrict the number of emails sent out per month per tenant only if the tenant is using your SMTP provider. Of course, you don't want to restrict those tenants who are using their own SMTP provider.

To set the quota you can use the appsettings.json file or an environment variable. The default value here is 1000 emails per month.

Tenants Email Quota Management Readme

Now it's time to try out this project and see it in action! The easiest way is to clone Lombiq's Open-Source Orchard Core Extensions solution. This Orchard Core Visual Studio solution contains most of Lombiq's open-source Orchard modules and themes, as well as related utilities and libraries, containing the Email quota management module too.

First of all, you need to enable the Lombiq Hosting - Tenants Email Quota Management module under Configuration -> Features. After that, let's navigate to Configuration -> Settings -> Email. And wow, you can see that we have already sent 997 emails out of 1000 this month. Yeah, we cheated a little bit and we already sent out some emails using workflows.

Email quota warning message

In this case, the users who have site owner permission will receive an email when the tenant reaches 80% of the available email quota for this month. They will get another email if you exceed 90% of the email quota.

When you reach your quota for this month, you will get a red notification that can be seen on every page in the admin UI. It means that you will not be able to send out more emails until next month.

Site sent out more e-mails than the available quota

As always, if you would like to know more about this module, head to YouTube for a recording!

News from the community

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 487 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who would like 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, don't forget to check out the recording of this Orchard meeting!

No Comments

Add a Comment