Skip to content

Commit

Permalink
检查并添加租户管理员角色;
Browse files Browse the repository at this point in the history
升级代码生成器,改进实体模型。
  • Loading branch information
nnhy committed Sep 10, 2023
1 parent da234c6 commit ef2c50e
Show file tree
Hide file tree
Showing 7 changed files with 459 additions and 437 deletions.
2 changes: 1 addition & 1 deletion CubeSSO/CubeSSO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.5.2023.824-beta1618" />
<PackageReference Include="NewLife.Core" Version="10.5.2023.903" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="2.9.2023.829-beta0552" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion NewLife.Cube.Blazor/NewLife.Cube.Blazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="7.9.3" />
<PackageReference Include="BootstrapBlazor" Version="7.10.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down
868 changes: 435 additions & 433 deletions NewLife.Cube/Entity/Cube.xml

Large diffs are not rendered by default.

Binary file modified NewLife.Cube/Entity/xcodetool.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion NewLife.Cube/NewLife.Cube.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<Compile Include="..\NewLife.CubeNC\WebMiddleware\TenantMiddleware.cs" Link="WebMiddleware\TenantMiddleware.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.5.2023.824-beta1618" />
<PackageReference Include="NewLife.Core" Version="10.5.2023.903" />
<PackageReference Include="NewLife.IP" Version="2.1.2023.704-beta0221" />
<PackageReference Include="NewLife.Stardust" Version="2.9.2023.829-beta0552" />
<PackageReference Include="NewLife.XCode" Version="11.9.2023.829-beta0727" />
Expand Down
20 changes: 20 additions & 0 deletions NewLife.CubeNC/Membership/ManagerProviderHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ public static void ChooseTenant(this HttpContext context, Int32 userId)
else
SaveTenant(context, 0);
}

CheckTenantRole();
}

private static Int32 _checkRole;
/// <summary>检查并添加租户管理员角色</summary>
private static void CheckTenantRole()
{
if (_checkRole > 0 || Interlocked.CompareExchange(ref _checkRole, 1, 0) != 0) return;

var role = Role.FindByName("租户管理员");
if (role == null)
{
role = new Role
{
Name = "租户管理员",
Enable = true,
};
role.Insert();
}
}

/// <summary>设置租户</summary>
Expand Down
2 changes: 1 addition & 1 deletion NewLife.CubeNC/NewLife.CubeNC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.5.2023.824-beta1618" />
<PackageReference Include="NewLife.Core" Version="10.5.2023.903" />
<PackageReference Include="NewLife.IP" Version="2.1.2023.704-beta0221" />
<PackageReference Include="NewLife.Stardust" Version="2.9.2023.829-beta0552" />
<PackageReference Include="NewLife.XCode" Version="11.9.2023.829-beta0727" />
Expand Down

0 comments on commit ef2c50e

Please sign in to comment.