Build Version Display module, prevent Users feature from breaking when Roles feature is disabled - This week in Orchard (27/01/2023)

Gábor Domonkos's avatar
Admin UI, Database, Multi-tenancy, Documentation, This week in Orchard, Role

Add permission check for the content type filter, prevent the Users feature from breaking when the Roles feature is disabled, add new database options, and a demo about the new Build Version Display module! Check out our post for the details!

Orchard Core updates

Add permission check for content type filter

The content type filter should only show accessible content types. The user should only see content types that they can view. Before this fix, all of the content types were listed, even if you don't have permission to see it.

Let's say that I am an editor user who has no access to view the Blog content type. In this case, when this user navigates to Content -> Content Items and clicks on the content type filter, the predefined Blog content item will not appear in the list.

Permission check for content type filter

Prevent the Users feature from breaking when the Roles feature is disabled

This was an old issue in Orchard Core if you disable the Roles module, the site crashes because the Users module needs the following services to work:

  • IRoleService
  • RoleManager
  • IRoleStore

This issue is now fixed, and you can disable the Roles module from the UI without facing an error. You can find the implementation details in this pull request, thanks to Mike Alhayek!

Disable the Roles module

Add database options like TablePrefixSeparator, Schema, IdentityColumnType, and DocumentTable

Here is a summary of the changes: both TableNameConvention and TablePrefixSeparator were removed from YesSqlOptions.

The following properties were added to the ShellSettings of each tenant:

  • TablePrefixSeparator when this value does not exist, we assume _, however, if an empty string is found, we use no prefix for the tables.
  • Schema was added to allow you to provide a specific schema to use.
  • IdentityColumnSize when this value is empty or invalid, we assume Int64.
  • DocumentTable when this value is empty, we assume Document.

If adding a new tenant failed due to missing Encrypt=false or TrustServerCertificate=True, we add the error to the log file to provide the admin with more about the issue.

The following means that now you can find a new section in the configuration called OrchardCore_Data_TableOptions. Now you can define the name of the Document table if you want to change it, change the table name separator (changing the _ in tenant1_tablename), and the default identity column size, which is Int64 by default. Every existing tenant will work with Int32, but the new tenants will use Int64. It can happen because YesSql now supports Int64 as well. You can find some new lines about these settings in the documentation as well. If you want to migrate the existing tenants, you have to do your own migration.

Updated appsettings with data table options

You can also define the schema of the tenant (DatabaseSchema) which is also configurable from the UI. This way all the table names are the same, just the schema that could be changed for each tenant.

Define the Table Schema in the admin UI


Lombiq Hosting - Build Version Display

The goal of the Lombiq Hosting - Build Version Display for Orchard Core module is to display the build version (i.e., .NET assembly version or other) on the admin of the Default tenant. By using this module, you can see at a glance which version of the app is deployed. But of course, there are various ways to know what's currently deployed into a specific environment (like staging or production), but the goal of this module is to cover the following use case: when you are looking at the app, you will know what's there.

The only thing you have to do is to install the module, and navigate to Configuration -> Features, and enable the Lombiq Hosting - Build Version Display feature. After you navigate to the homepage of the admin UI, you will see the following on the dashboard. You can find the Orchard Core version, the version of the .NET assembly is currently being executed, which means the web application. If you have a CI build, usually that will generate a version number for you. And finally, during the build, you can also add a link to the build. This is just a dummy link for examples, but you can link to a GitHub action. You can read more about it in the Readme file of the module.

Enabling the Build Version Display module

Do you want to quickly try out this project and see it in action? Check it out in our Open-Source Orchard Core Extensions full Orchard Core solution, and also see our other useful Orchard Core-related open-source projects! And as always, if you want to know more about this feature, head to YouTube for a recording!

News from the community

Orchard Dojo Newsletter

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