Skip to content

Commit

Permalink
Version 1.2.5:
Browse files Browse the repository at this point in the history
Added support for DNN 9.8.1
New feature "Export Users By Role"
Fixed an issue with Export for SuperUsers account
Fixed an issue with Import for version of DNN 9.8.1
  • Loading branch information
fordnn committed Feb 15, 2021
1 parent 3dcf4b3 commit 705cff3
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 5 deletions.
6 changes: 6 additions & 0 deletions App_LocalResources/MainControl.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,10 @@
<data name="UpdateExistingUser.Help" xml:space="preserve">
<value>Update existing user when UserName exists in DB</value>
</data>
<data name="AllRoles.Text" xml:space="preserve">
<value>All Roles</value>
</data>
<data name="ExportByRole.Text" xml:space="preserve">
<value>Export By Role</value>
</data>
</root>
10 changes: 9 additions & 1 deletion Components/ExportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static string DoExport(int PortalId, Models.ExportInfo objExportInfo)
//check authorised accounts
if (!objExportInfo.IncludeNonAuthorised)
{
sbWhere.Append(" AND (u.Authorised=1) ");
sbWhere.Append(" AND ((u.Authorised=1) OR (u.IsSuperUser=1)) ");
}

//check if requires to export roles
Expand All @@ -108,6 +108,8 @@ FOR XML PATH('')) Roles
//define properties
foreach (string li in objExportInfo.PropertiesToExport.Split(new char[] { ',' }))
{
if (li.Trim() == "") continue;

string[] objParam = li.Split(new char[] { '=' });
if (htFieldNames[objParam[0]] != null)
{
Expand All @@ -126,6 +128,12 @@ FOR XML PATH('')) Roles
.Replace("{0}", objParam[1]));
}

if (objExportInfo.ExportByRole != -1)
{
sbWhere.Append(" AND (u.UserID IN (SELECT UserID FROM {databaseOwner}{objectQualifier}UserRoles WHERE RoleID={0})) "
.Replace("{0}", objExportInfo.ExportByRole.ToString()));
}

idr = DotNetNuke.Data.DataProvider.Instance().ExecuteSQL(sbSelect.ToString() + sbFrom.ToString() + sbWhere.ToString());
DataTable dt = DotNetNuke.Common.Globals.ConvertDataReaderToDataTable(idr);
if (objExportInfo.ExportPasswords)
Expand Down
8 changes: 7 additions & 1 deletion Install/_UsersExportImport.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="forDNN.UsersExportImport" type="Module" version="1.2.4">
<package name="forDNN.UsersExportImport" type="Module" version="1.2.5">
<friendlyName>forDNN.UsersExportImport</friendlyName>
<description>This module allows to export/import users, user profiles properties and roles to DNN (former DotNetNuke) from CSV/XML files. This is simple and fast way to create your users accounts in one click.</description>
<owner>
Expand All @@ -25,6 +25,12 @@
</license>
<releaseNotes>
<![CDATA[
<b>Version 1.2.5:</b><br />
Added support for DNN 9.8.1<br />
New feature "Export Users By Role"<br />
Fixed an issue with Export for SuperUsers account<br />
Fixed an issue with Import for version of DNN 9.8.1<br />

<b>Version 1.2.4:</b><br />
Fixed an issue when CSV generated on UNIX systems (different NewLine)<br />
Fixed an issue when updating custom profiles on existing users accounts<br />
Expand Down
Binary file added Install/forDNN.UsersExportImport_v.01.02.05.zip
Binary file not shown.
6 changes: 6 additions & 0 deletions MainControl.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<asp:ListItem Value="2" resourcekey="ExportFileType_2" Selected></asp:ListItem>
</asp:DropDownList>
</div>
<div class="dnnFormItem">
<dnn:Label runat="server" ID="lblbExportByRole" resourcekey="ExportByRole"></dnn:Label>
<asp:DropDownList runat="server" ID="ddlExportByRole" Style="width: 100px;">
</asp:DropDownList>
</div>
<div class="dnnFormItem" runat="server" id="divIncludeSuperUsers">
<dnn:Label runat="server" id="lblIncludeSuperUsers" resourcekey="IncludeSuperUsers" AssociatedControlID="cbIncludeSuperUsers"></dnn:Label>
<asp:CheckBox runat="server" ID="cbIncludeSuperUsers" CssClass="normalCheckBox" />
Expand Down Expand Up @@ -162,6 +167,7 @@
{
var objValues = new Object();
objValues.ExportFileType = $("#<%=ddlExportFileType.ClientID%>").val();
objValues.ExportByRole = $("#<%=ddlExportByRole.ClientID%>").val();
objValues.IncludeSuperUsers = $("#<%=cbIncludeSuperUsers.ClientID%>").prop("checked");
objValues.IncludeDeleted = $("#<%=cbIncludeDeleted.ClientID%>").prop("checked");
objValues.IncludeNonAuthorised = $("#<%=cbIncludeNonAuthorised.ClientID%>").prop("checked");
Expand Down
8 changes: 8 additions & 0 deletions MainControl.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ private void ExtraPageLoad()
}
}

ddlExportByRole.Items.Clear();
ddlExportByRole.Items.Add(new ListItem(Localization.GetString("AllRoles", this.LocalResourceFile), "-1"));
RoleController objRoleController = new RoleController();
foreach (RoleInfo objRole in objRoleController.GetRoles(this.PortalId))
{
ddlExportByRole.Items.Add(new ListItem(objRole.RoleName, objRole.RoleID.ToString()));
}

btnExportUsers.Attributes.Add("onclick", string.Format("javascript:return doExport({0});", this.ModuleId));
btnImport.Attributes.Add("onclick", string.Format("javascript:return doImport({0});", this.ModuleId));
}
Expand Down
18 changes: 18 additions & 0 deletions MainControl.ascx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Models/ExportInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ public class ExportInfo
public bool ExportRoles { get; set; }
public bool ExportPasswords { get; set; }
public string PropertiesToExport { get; set; }
public int ExportByRole { get; set; }
}
}
2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.4.*")]
[assembly: AssemblyVersion("1.2.5.*")]
2 changes: 1 addition & 1 deletion UsersExportImport.csproj.user
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ReferencePath>C:\WebSites\dnn910\bin\</ReferencePath>
<ReferencePath>C:\WebSites\dnn981\bin\</ReferencePath>
<UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<ProjectExtensions>
Expand Down
2 changes: 1 addition & 1 deletion web.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<compilation debug="true" targetFramework="4.7.2"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
Expand Down

0 comments on commit 705cff3

Please sign in to comment.