Skip to content

Commit f86766a

Browse files
committed
Merge remote-tracking branch 'dnnsoftware/release/10.0.0' into feature/bulk-install
2 parents fbbf141 + c47ae13 commit f86766a

File tree

14 files changed

+651
-7159
lines changed

14 files changed

+651
-7159
lines changed

Build/Tasks/packaging.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"/bin/Dnn.PersonaBar.*",
2020
"/bin/DotNetNuke.Authentication.*",
2121
"/bin/DotNetNuke.Modules.*",
22+
"/bin/DotNetNuke.Internal.*",
2223
"/bin/DotNetNuke.Web.Deprecated.dll",
2324
"/bin/DotNetNuke.Website.Deprecated.dll",
2425
"/bin/System.IdentityModel.Tokens.Jwt.*",

DNN Platform/Library/Common/Extensions/HttpContextDependencyInjectionExtensions.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace DotNetNuke.Common.Extensions
66
{
7+
using System.Collections;
78
using System.Web;
89

910
using Microsoft.Extensions.DependencyInjection;
@@ -51,9 +52,10 @@ public static IServiceScope GetScope(this HttpContext httpContext)
5152
/// <returns>A service scope.</returns>
5253
public static IServiceScope GetScope(this HttpContextBase httpContext)
5354
{
54-
if (httpContext.Items.Contains(typeof(IServiceScope)))
55+
var scope = httpContext.Items.GetScope();
56+
if (scope is not null || Globals.DependencyProvider is null)
5557
{
56-
return httpContext.Items[typeof(IServiceScope)] as IServiceScope;
58+
return scope;
5759
}
5860

5961
var scopeLock = new object();
@@ -64,7 +66,6 @@ public static IServiceScope GetScope(this HttpContextBase httpContext)
6466
return GetScope(httpContext);
6567
}
6668

67-
IServiceScope scope = null;
6869
httpContext.Items.Add(ScopeLockName, scopeLock);
6970
lock (httpContext.Items[ScopeLockName])
7071
{
@@ -87,9 +88,14 @@ public static IServiceScope GetScope(this HttpContextBase httpContext)
8788
return GetScope(httpContext);
8889
}
8990

91+
private static IServiceScope GetScope(this IDictionary httpContextItems)
92+
{
93+
return httpContextItems[typeof(IServiceScope)] as IServiceScope;
94+
}
95+
9096
private static void DisposeScope(HttpContextBase httpContext)
9197
{
92-
httpContext.GetScope()?.Dispose();
98+
httpContext.Items.GetScope()?.Dispose();
9399
httpContext.ClearScope();
94100
}
95101
}

DNN Platform/Library/Security/PortalSecurity.cs

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ private enum RoleType
137137
Owner = 3,
138138
}
139139

140+
/// <summary>
141+
/// Forces the secure connection.
142+
/// </summary>
140143
public static void ForceSecureConnection()
141144
{
142145
// get current url
@@ -163,6 +166,11 @@ public static void ForceSecureConnection()
163166
}
164167
}
165168

169+
/// <summary>
170+
/// Gets the cookie domain for the portal group or from web.config.
171+
/// </summary>
172+
/// <param name="portalId">The portal identifier.</param>
173+
/// <returns>Cookie domain for the portal group or from web.config.</returns>
166174
public static string GetCookieDomain(int portalId)
167175
{
168176
string cookieDomain = string.Empty;
@@ -193,13 +201,29 @@ public static string GetCookieDomain(int portalId)
193201
return cookieDomain;
194202
}
195203

204+
/// <summary>
205+
/// Determines whether the current user is denied for the given role(s).
206+
/// </summary>
207+
/// <param name="roles">The semicolon separated list of roles.</param>
208+
/// <returns>
209+
/// <c>true</c> if the current user is denied from the provided specified roles; otherwise, <c>false</c>.
210+
/// </returns>
196211
public static bool IsDenied(string roles)
197212
{
198213
UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo();
199214
PortalSettings settings = PortalController.Instance.GetCurrentPortalSettings();
200215
return IsDenied(objUserInfo, settings, roles);
201216
}
202217

218+
/// <summary>
219+
/// Determines whether the specified user is denied for the given roles.
220+
/// </summary>
221+
/// <param name="objUserInfo">The user information.</param>
222+
/// <param name="settings">The settings.</param>
223+
/// <param name="roles">The semicolon separated list of roles.</param>
224+
/// <returns>
225+
/// <c>true</c> if the specified user is denied; otherwise, <c>false</c>.
226+
/// </returns>
203227
public static bool IsDenied(UserInfo objUserInfo, PortalSettings settings, string roles)
204228
{
205229
// super user always has full access
@@ -238,6 +262,13 @@ public static bool IsDenied(UserInfo objUserInfo, PortalSettings settings, strin
238262
return isDenied;
239263
}
240264

265+
/// <summary>
266+
/// Determines whether the current user belonds to the specified role.
267+
/// </summary>
268+
/// <param name="role">The role name.</param>
269+
/// <returns>
270+
/// <c>true</c> if user belongs to the specified role; otherwise, <c>false</c>.
271+
/// </returns>
241272
public static bool IsInRole(string role)
242273
{
243274
if (!string.IsNullOrEmpty(role) && role == Globals.glbRoleUnauthUserName && !HttpContext.Current.Request.IsAuthenticated)
@@ -248,13 +279,29 @@ public static bool IsInRole(string role)
248279
return IsInRoles(UserController.Instance.GetCurrentUserInfo(), PortalController.Instance.GetCurrentPortalSettings(), role);
249280
}
250281

282+
/// <summary>
283+
/// Determines whether the current user belongs to the specified roles.
284+
/// </summary>
285+
/// <param name="roles">The semicolon separated list of roles.</param>
286+
/// <returns>
287+
/// <c>true</c> if user belongs to the specified roles; otherwise, <c>false</c>.
288+
/// </returns>
251289
public static bool IsInRoles(string roles)
252290
{
253291
UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo();
254292
PortalSettings settings = PortalController.Instance.GetCurrentPortalSettings();
255293
return IsInRoles(objUserInfo, settings, roles);
256294
}
257295

296+
/// <summary>
297+
/// Determines whether the provided user belongs to the specified roles.
298+
/// </summary>
299+
/// <param name="objUserInfo">The user information.</param>
300+
/// <param name="settings">The settings.</param>
301+
/// <param name="roles">The semicolon separated list of roles.</param>
302+
/// <returns>
303+
/// <c>true</c> if the provided user belongs to the specific roles; otherwise, <c>false</c>.
304+
/// </returns>
258305
public static bool IsInRoles(UserInfo objUserInfo, PortalSettings settings, string roles)
259306
{
260307
// super user always has full access
@@ -280,20 +327,41 @@ public static bool IsInRoles(UserInfo objUserInfo, PortalSettings settings, stri
280327
return isInRoles;
281328
}
282329

330+
/// <summary>
331+
/// Determines whether the specified user is a friend of the current user.
332+
/// </summary>
333+
/// <param name="userId">The user identifier.</param>
334+
/// <returns>
335+
/// <c>true</c> if the specified user is a friend of the current user; otherwise, <c>false</c>.
336+
/// </returns>
283337
public static bool IsFriend(int userId)
284338
{
285339
UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo();
286340
PortalSettings settings = PortalController.Instance.GetCurrentPortalSettings();
287341
return IsInRoles(objUserInfo, settings, RoleFriendPrefix + userId);
288342
}
289343

344+
/// <summary>
345+
/// Determines whether the specified user is a follower of the current user.
346+
/// </summary>
347+
/// <param name="userId">The user identifier.</param>
348+
/// <returns>
349+
/// <c>true</c> if the specified user is a follower of the current user; otherwise, <c>false</c>.
350+
/// </returns>
290351
public static bool IsFollower(int userId)
291352
{
292353
UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo();
293354
PortalSettings settings = PortalController.Instance.GetCurrentPortalSettings();
294355
return IsInRoles(objUserInfo, settings, RoleFollowerPrefix + userId);
295356
}
296357

358+
/// <summary>
359+
/// Determines whether the specified user is an owner.
360+
/// </summary>
361+
/// <param name="userId">The user identifier.</param>
362+
/// <returns>
363+
/// <c>true</c> if the specified user is an owner; otherwise, <c>false</c>.
364+
/// </returns>
297365
public static bool IsOwner(int userId)
298366
{
299367
UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo();
@@ -315,21 +383,45 @@ public string CreateKey(int numBytes)
315383
}
316384
}
317385

386+
/// <summary>
387+
/// Decrypts the provided string data using a supplied key.
388+
/// </summary>
389+
/// <param name="strKey">The encryption key.</param>
390+
/// <param name="strData">The encrypted data.</param>
391+
/// <returns>The decrypted string.</returns>
318392
public string Decrypt(string strKey, string strData)
319393
{
320394
return CryptographyProvider.Instance().DecryptParameter(strData, strKey);
321395
}
322396

397+
/// <summary>
398+
/// Decrypts a string using a provided passphrase.
399+
/// </summary>
400+
/// <param name="message">The encrypted message.</param>
401+
/// <param name="passphrase">The passphrase.</param>
402+
/// <returns>The decrypted string.</returns>
323403
public string DecryptString(string message, string passphrase)
324404
{
325405
return CryptographyProvider.Instance().DecryptString(message, passphrase);
326406
}
327407

408+
/// <summary>
409+
/// Encrypts the specified key.
410+
/// </summary>
411+
/// <param name="key">The key.</param>
412+
/// <param name="data">The data.</param>
413+
/// <returns>The encrypted string.</returns>
328414
public string Encrypt(string key, string data)
329415
{
330416
return CryptographyProvider.Instance().EncryptParameter(data, key);
331417
}
332418

419+
/// <summary>
420+
/// Encrypts a string using a provided passphrase.
421+
/// </summary>
422+
/// <param name="message">The message.</param>
423+
/// <param name="passphrase">The passphrase.</param>
424+
/// <returns>The encrypted string.</returns>
333425
public string EncryptString(string message, string passphrase)
334426
{
335427
return CryptographyProvider.Instance().EncryptString(message, passphrase);
@@ -500,6 +592,11 @@ public string Remove(string inputString, ConfigType configType, string configSou
500592
return inputString;
501593
}
502594

595+
/// <summary>
596+
/// Signs the provided user in and sets a persistent login cookie if needed.
597+
/// </summary>
598+
/// <param name="user">The user info.</param>
599+
/// <param name="createPersistentCookie">if set to <c>true</c> [create persistent cookie].</param>
503600
public void SignIn(UserInfo user, bool createPersistentCookie)
504601
{
505602
if (PortalController.IsMemberOfPortalGroup(user.PortalID) || createPersistentCookie)
@@ -574,6 +671,9 @@ public void SignIn(UserInfo user, bool createPersistentCookie)
574671
HttpContext.Current.Items["DNN_UserSignIn"] = true;
575672
}
576673

674+
/// <summary>
675+
/// Signs the current user out.
676+
/// </summary>
577677
public void SignOut()
578678
{
579679
InvalidateAspNetSession(HttpContext.Current);

DNN Platform/Library/Services/Localization/LocalizationProvider.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,22 +211,26 @@ private static object GetCompiledResourceFileCallBack(CacheItemArgs cacheItemArg
211211
// clone the dictionart so that when merge values into dictionart, it won't
212212
// affect the cache data.
213213
res = res.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
214+
res = MergeResourceFile(res, GetResourceFileNameHost(resourceFile, systemLanguage));
214215
res = MergeResourceFile(res, GetResourceFileName(resourceFile, systemLanguage, portalSettings.PortalId));
215216
if (defaultLanguage != systemLanguage)
216217
{
217218
res = MergeResourceFile(res, GetResourceFileName(resourceFile, defaultLanguage));
219+
res = MergeResourceFile(res, GetResourceFileNameHost(resourceFile, defaultLanguage));
218220
res = MergeResourceFile(res, GetResourceFileName(resourceFile, defaultLanguage, portalSettings.PortalId));
219221
}
220222

221223
if (fallbackLanguage != defaultLanguage)
222224
{
223225
res = MergeResourceFile(res, GetResourceFileName(resourceFile, fallbackLanguage));
226+
res = MergeResourceFile(res, GetResourceFileNameHost(resourceFile, fallbackLanguage));
224227
res = MergeResourceFile(res, GetResourceFileName(resourceFile, fallbackLanguage, portalSettings.PortalId));
225228
}
226229

227230
if (locale != fallbackLanguage)
228231
{
229232
res = MergeResourceFile(res, GetResourceFileName(resourceFile, locale));
233+
res = MergeResourceFile(res, GetResourceFileNameHost(resourceFile, locale));
230234
res = MergeResourceFile(res, GetResourceFileName(resourceFile, locale, portalSettings.PortalId));
231235
}
232236

@@ -363,6 +367,14 @@ private static Dictionary<string, string> GetResourceFile(string resourceFile)
363367
true);
364368
}
365369

370+
private static string GetResourceFileNameHost(string resourceFileRoot, string language)
371+
{
372+
string resourceFile = GetResourceFileName(resourceFileRoot, language);
373+
resourceFile = resourceFile.Replace(".resx", ".Host.resx");
374+
375+
return resourceFile;
376+
}
377+
366378
private static string GetResourceFileName(string resourceFileRoot, string language, int portalId)
367379
{
368380
string resourceFile = GetResourceFileName(resourceFileRoot, language);

DNN Platform/Modules/DnnExportImport/DnnExportImport.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
<Content Include="Providers\DataProviders\SqlDataProvider\09.01.00.SqlDataProvider" />
200200
<Content Include="Providers\DataProviders\SqlDataProvider\09.01.01.SqlDataProvider" />
201201
<Content Include="Providers\DataProviders\SqlDataProvider\09.02.00.SqlDataProvider" />
202+
<None Include="Providers\DataProviders\SqlDataProvider\09.12.01.SqlDataProvider" />
202203
<None Include="Providers\DataProviders\SqlDataProvider\09.03.00.SqlDataProvider" />
203204
<None Include="Providers\DataProviders\SqlDataProvider\Uninstall.SqlDataProvider" />
204205
</ItemGroup>

0 commit comments

Comments
 (0)