Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nhathoang989 committed Oct 16, 2023
1 parent ff68f95 commit 3556fa8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public ApplicationViewModel(UnitOfWorkInfo unitOfWorkInfo) : base(unitOfWorkInfo
#endregion

#region Properties
public string Title { get; set; }
public string BaseHref { get; set; }
public string BaseRoute { get; set; }
public string DeployUrl { get; set; }
public JObject AppSettings { get; set; }
public string Domain { get; set; }
public string BaseApiUrl { get; set; }
public int? TemplateId { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/applications/Mixcore/Views/App/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else
</section>
}
@section Seo{
<title>@Model.Title</title>
<title>@Model.DisplayName</title>
<meta property="og:type" content="post" />
<!--points to the regular HTML version of the AMP HTML document or to itself if no such HTML version exists-->
}
Expand Down
2 changes: 1 addition & 1 deletion src/applications/Mixcore/Views/Home/App.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else
</section>
}
@section Seo{
<title>@Model.Title</title>
<title>@Model.DisplayName</title>
<meta property="og:type" content="post" />
<!--points to the regular HTML version of the AMP HTML document or to itself if no such HTML version exists-->
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public async Task<MixApplicationViewModel> Install(MixApplicationViewModel app,
Styles = string.Empty,
CreatedBy = _mixIdentityService.GetClaim(HttpContextAccessor.HttpContext.User, MixClaims.Username)
};
template.Content = indexFile.Content.Replace("@", "@@");
template.Content = indexFile.Content.Replace("@", "@@")
.Replace("<body>", "<body><pre id=\"app-settings-container\" style=\"display:none\">@Model.AppSettings.ToString()</pre>");
await template.SaveAsync();
_queueService.PushQueue(CurrentTenant.Id, MixQueueTopics.MixViewModelChanged, MixRestAction.Post.ToString(), template);
MixFileHelper.SaveFile(indexFile);
Expand Down
19 changes: 12 additions & 7 deletions src/platform/mix.service/Services/MixPermissionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.EntityFrameworkCore;
using Mix.Constant.Constants;
using Mix.Database.Entities.Account;
using Mix.Database.Entities.Cms;
using Mix.Database.Entities.MixDb;
using Mix.Database.Services;
using Mix.Heart.Exceptions;
Expand Down Expand Up @@ -32,7 +33,8 @@ public async Task Reload()
{
if (!GlobalConfigService.Instance.IsInit)
{
UnitOfWorkInfo<MixDbDbContext> uow = new(new MixDbDbContext(_databaseService));
UnitOfWorkInfo<MixCmsContext> cmsUow = new(new MixCmsContext(_databaseService));
UnitOfWorkInfo<MixDbDbContext> mixdbUow = new(new MixDbDbContext(_databaseService));
try
{
RoleEndpoints = new Dictionary<string, string[]>();
Expand All @@ -42,17 +44,19 @@ public async Task Reload()

foreach (var role in roles)
{
var permissionIds = uow.DbContext.MixDatabaseAssociation
var permissionIds = cmsUow.DbContext.MixDatabaseAssociation
.Where(m => m.GuidParentId == role.Id)
.Select(m => m.ChildId);
var endpointIds = uow.DbContext.MixDatabaseAssociation
.Select(m => m.ChildId)
.ToList();
var endpointIds = cmsUow.DbContext.MixDatabaseAssociation
.Where(m => m.ParentDatabaseName == MixDatabaseNames.SYSTEM_PERMISSION
&& m.ChildDatabaseName == MixDatabaseNames.SYSTEM_PERMISSION_ENDPOINT
&& permissionIds.Contains(m.ParentId))
.Select(m => m.ChildId);
.Select(m => m.ChildId)
.ToList();

// TODO: PermissionEndpoint cannot initial at first time
var endpoints = await uow.DbContext.PermissionEndpoint.Where(
var endpoints = await mixdbUow.DbContext.PermissionEndpoint.Where(
m => endpointIds.Contains(m.Id)
&& !string.IsNullOrEmpty(m.Path)
)
Expand Down Expand Up @@ -83,7 +87,8 @@ public async Task Reload()
}
finally
{
uow.Dispose();
cmsUow.Dispose();
mixdbUow.Dispose();
accountDbContext.Dispose();
}
}
Expand Down

0 comments on commit 3556fa8

Please sign in to comment.