Skip to content

Commit

Permalink
wip: 一些更改
Browse files Browse the repository at this point in the history
  • Loading branch information
gmf520 committed Sep 6, 2024
1 parent d31bd5a commit 87a7037
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 22 deletions.
22 changes: 11 additions & 11 deletions build/OSharpNS.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>OSharpNS</id>
<version>6.0.10-preview.1021</version>
<version>8.0.1-preview.501</version>
<title>OSharpFramework(.NET6.0/.NETCoreApp3.1)</title>
<authors>柳柳软件(66soft.net)</authors>
<owners>LiuliuSoft nnc</owners>
Expand All @@ -16,18 +16,18 @@
<tags>osharp</tags>
<dependencies>
<group targetFramework=".NETCoreApp3.1">
<dependency id="OSharp.Core" version="6.0.10-preview.1021" />
<dependency id="OSharp.EntityFrameworkCore" version="6.0.10-preview.1021" />
<dependency id="OSharp.AutoMapper" version="6.0.10-preview.1021" />
<dependency id="OSharp.AspNetCore" version="6.0.10-preview.1021" />
<dependency id="OSharp.Log4Net" version="6.0.10-preview.1021" />
<dependency id="OSharp.Core" version="8.0.1-preview.501" />
<dependency id="OSharp.EntityFrameworkCore" version="8.0.1-preview.501" />
<dependency id="OSharp.AutoMapper" version="8.0.1-preview.501" />
<dependency id="OSharp.AspNetCore" version="8.0.1-preview.501" />
<dependency id="OSharp.Log4Net" version="8.0.1-preview.501" />
</group>
<group targetFramework="net6.0">
<dependency id="OSharp.Core" version="6.0.10-preview.1021" />
<dependency id="OSharp.EntityFrameworkCore" version="6.0.10-preview.1021" />
<dependency id="OSharp.AutoMapper" version="6.0.10-preview.1021" />
<dependency id="OSharp.AspNetCore" version="6.0.10-preview.1021" />
<dependency id="OSharp.Log4Net" version="6.0.10-preview.1021" />
<dependency id="OSharp.Core" version="8.0.1-preview.501" />
<dependency id="OSharp.EntityFrameworkCore" version="8.0.1-preview.501" />
<dependency id="OSharp.AutoMapper" version="8.0.1-preview.501" />
<dependency id="OSharp.AspNetCore" version="8.0.1-preview.501" />
<dependency id="OSharp.Log4Net" version="8.0.1-preview.501" />
</group>
</dependencies>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion build/version.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<VersionMain>8.0</VersionMain>
<VersionPrefix>1</VersionPrefix>
<VersionSuffix>-preview.</VersionSuffix>
<VersionSuffixVersion>113</VersionSuffixVersion>
<VersionSuffixVersion>529</VersionSuffixVersion>
<Version>$(VersionMain).$(VersionPrefix)$(VersionSuffix)$(VersionSuffixVersion)</Version>
<FileVersion>$(VersionMain).$(VersionPrefix).$(VersionSuffixVersion)</FileVersion>
<!--<Version>$(VersionMain).$(VersionPrefix)</Version>
Expand Down
11 changes: 7 additions & 4 deletions osharp.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/JavaScriptCodeFormatting/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/JavaScriptCodeFormatting/STICK_COMMENT/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">-----------------------------------------------------------------------&#xD;
&lt;copyright file="$FILENAME$" company="OSharp开源团队"&gt;&#xD;
Copyright (c) 2014-$CURRENT_YEAR$ OSharp. All rights reserved.&#xD;
&lt;copyright file="${File.FileName}" company="OSharp开源团队"&gt;&#xD;
Copyright (c) 2014-${CurrentDate.Year} OSharp. All rights reserved.&#xD;
&lt;/copyright&gt;&#xD;
&lt;site&gt;http://www.osharp.org&lt;/site&gt;&#xD;
&lt;last-editor&gt;$USER_NAME$&lt;/last-editor&gt;&#xD;
&lt;last-date&gt;$CURRENT_YEAR$-$CURRENT_MONTH$-$CURRENT_DAY$ $CURRENT_TIME$&lt;/last-date&gt;&#xD;
&lt;last-editor&gt;${User.Name}&lt;/last-editor&gt;&#xD;
&lt;last-date&gt;${CurrentDate.Year}-${CurrentDate.Month}-${CurrentDate.Day} ${CurrentDate.Hour}:${CurrentDate.Minute}&lt;/last-date&gt;&#xD;
-----------------------------------------------------------------------</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DBC/@EntryIndexedValue">DBC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DI/@EntryIndexedValue">DI</s:String>
Expand All @@ -114,6 +114,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SBC/@EntryIndexedValue">SBC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TB/@EntryIndexedValue">TB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=15b5b1f1_002D457c_002D4ca6_002Db278_002D5615aedc07d3/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FCONSTANT/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FFUNCTION/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FVARIABLE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
Expand Down Expand Up @@ -163,6 +164,7 @@
<s:Boolean x:Key="/Default/Environment/ParameterNameHintsOptions/ShowParameterNameHints/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=VCS/@EntryIndexedValue">LIVE_MONITOR</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchConflictResolutionMode/=VCS/@EntryIndexedValue">NOTIFY</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECSharp_002EParameterNameHints_002ECSharpParameterNameHintsOptionsMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002EInlayHints_002EInlayHintsOptionsMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002EVB_002EParameterNameHints_002EVBParameterNameHintsOptionsMigration/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -175,6 +177,7 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsParsFormattingSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsWrapperSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EUnitTestFramework_002EMigrations_002EEnableDisabledProvidersMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
3 changes: 1 addition & 2 deletions src/OSharp.AspNetCore/HttpRequestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public static class HttpContextExtensions
/// <summary>
/// 确定指定的 HTTP 请求是否为 AJAX 请求。
/// </summary>
///
/// <returns>
/// 如果指定的 HTTP 请求是 AJAX 请求,则为 true;否则为 false。
/// </returns>
Expand Down Expand Up @@ -75,7 +74,7 @@ public static string GetClientIp(this HttpContext context)
string ip = context.Request.Headers["X-Forwarded-For"].FirstOrDefault();
if (string.IsNullOrEmpty(ip))
{
ip = context.Connection.RemoteIpAddress.ToString();
ip = context.Connection.RemoteIpAddress?.ToString();
}
return ip;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void OnActionExecuting(ActionExecutingContext context)
UserAgent = context.HttpContext.Request.Headers["User-Agent"].FirstOrDefault(),
CreatedTime = DateTime.Now
};
if (context.HttpContext.User.Identity.IsAuthenticated && context.HttpContext.User.Identity is ClaimsIdentity identity)
if (context.HttpContext.User.Identity?.IsAuthenticated == true && context.HttpContext.User.Identity is ClaimsIdentity identity)
{
operation.UserId = identity.GetUserId();
operation.UserName = identity.GetUserName();
Expand Down
20 changes: 19 additions & 1 deletion src/OSharp.Hosting.Core/Identity/Entities/Organization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ namespace OSharp.Hosting.Identity.Entities;
/// </summary>
[Description("组织机构信息")]
[TableNamePrefix("Identity")]
public class Organization : EntityBase<int>
public class Organization : EntityBase<int>, ILockable, ICreatedTime
{
/// <summary>
/// 获取或设置 名称
/// </summary>
[Required, DisplayName("名称"), StringLength(200)]
public string Name { get; set; }

/// <summary>
/// 获取或设置 编码
/// </summary>
[Required, DisplayName("编码"), StringLength(200)]
public string Code { get; set; }

/// <summary>
/// 获取或设置 描述
/// </summary>
Expand All @@ -33,4 +39,16 @@ public class Organization : EntityBase<int>
/// </summary>
[DisplayName("父组织机构编号")]
public int? ParentId { get; set; }

/// <summary>
/// 获取或设置 是否锁定当前信息
/// </summary>
[DisplayName("是否锁定")]
public bool IsLocked { get; set; }

/// <summary>
/// 获取或设置 创建时间
/// </summary>
[DisplayName("创建时间")]
public DateTime CreatedTime { get; set; }
}
2 changes: 1 addition & 1 deletion src/OSharp.Identity/Authentication/UserClaimsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task<Claim[]> CreateClaims(string userId)
/// <returns>刷新后的Identity</returns>
public async Task<OperationResult<ClaimsIdentity>> RefreshIdentity(ClaimsIdentity identity)
{
if (identity != null && identity.IsAuthenticated)
if (identity is { IsAuthenticated: true })
{
IOnlineUserProvider onlineUserProvider = _provider.GetService<IOnlineUserProvider>();
OnlineUser onlineUser = await onlineUserProvider.GetOrCreate(identity.Name);
Expand Down
2 changes: 1 addition & 1 deletion src/OSharp.Identity/Identity/IdentityPackBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// <copyright file="IdentityPackBase.cs" company="OSharp开源团队">
// Copyright (c) 2014-2018 OSharp. All rights reserved.
// </copyright>
Expand Down

0 comments on commit 87a7037

Please sign in to comment.