Import/Export does not import module permissions for custom roles

Overview

An administrator has imported a site; however, they are facing an issue with the module permissions not being imported for custom roles. The custom role permissions exist on the target site for pages; however, no permissions are added for modules and it only inherits the default ones from a page.

If the import is run a second time in the source site, the following error will be thrown:

Dnn.ExportImport.Components.Engines.ExportImportEngine - System.NullReferenceException: Object reference not set to an instance of an object. 
   at Dnn.ExportImport.Components.Services.PagesExportService.<>c__DisplayClass38_1.<ImportModulePermissions>b__0(ModulePermissionInfo x) 
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) 
   at Dnn.ExportImport.Components.Services.PagesExportService.ImportModulePermissions(ModuleInfo localModule, ExportModule otherModule, Boolean isNew) 
   at Dnn.ExportImport.Components.Services.PagesExportService.ImportTabModulesAndRelatedItems(TabInfo localTab, ExportTab otherTab, Boolean isNew) 

 

Prerequisites

 

Diagnosis

This issue was being caused by a known defect due to DNN being unable to save the module permissions on the database and caused a conflict with different Role IDs on source and target instances.

 

Solution

The issue was considered a defect and it has been fixed on DNN version 9.2.1 and above.

Unfortunately, there is no workaround for this behavior, you will need to:

 

Testing

You can test that this is resolved by:

  1. Import the export package once again
  2. Browse to any module settings with custom roles set for them

You should see that the custom role permissions have been imported over.

 

Comments

0 comments

Please sign in to leave a comment.