Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Sep 27, 2024
1 parent 683956d commit 96d30e5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Text.Json.Serialization;

namespace Coalesce.Starter.Vue.Data;
namespace Coalesce.Starter.Vue.Data;

/// <summary>
/// The permissions available for assignment to <see cref="Models.Role"/>s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public class DefaultSource(CrudContext<AppDbContext> context) : AppDataSource<Te
{
public override IQueryable<Tenant> GetQuery(IDataSourceParameters parameters)
{
// By default, only allow the current tenant to be read and modified.
// If desired, this can be made more permissive.
// Only allow the current tenant to be read and modified.
return base.GetQuery(parameters)
.Where(t => t.TenantId == User.GetTenantId());
}
Expand All @@ -53,7 +52,8 @@ public static async Task<ItemResult> Create(
AppDbContext db,
[Inject] InvitationService invitationService,
[Display(Name = "Org Name")] string name,
[DataType(DataType.EmailAddress)] string adminEmail)
[DataType(DataType.EmailAddress)] string adminEmail
)
{
Tenant tenant = new() { Name = name };
db.Tenants.Add(tenant);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using IntelliTect.Coalesce.Helpers;
using Microsoft.AspNetCore.Identity;
using System.ComponentModel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => {
module.EnableSqlCommandTextInstrumentation = true;
});
// App insights filters all logs to Warning by default.
// App insights filters all logs to Warning by default. We want to include our own logging.
builder.Logging.AddFilter<ApplicationInsightsLoggerProvider>("Coalesce.Starter.Vue", LogLevel.Information);
#endif

Expand Down Expand Up @@ -97,12 +97,14 @@
services.AddScoped<SecurityService>();

#if TenantMemberInvites
// Register IUrlHelper to allow for invite link generation.
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
services.AddScoped<IUrlHelper>(x => {
var actionContext = x.GetRequiredService<IActionContextAccessor>().ActionContext;
var factory = x.GetRequiredService<IUrlHelperFactory>();
return factory.GetUrlHelper(actionContext!);
});

services.AddScoped<InvitationService>();
#endif

Expand Down Expand Up @@ -146,16 +148,6 @@
app.UseAuthentication();
app.UseAuthorization();

//app.Use(async (context, next) =>
//{
// if (context.User.GetTenantId() is int tenantId)
// {
// context.RequestServices.GetRequiredService<AppDbContext>().TenantId = tenantId;
// }

// await next(context);
//});

var containsFileHashRegex = new Regex(@"[.-][0-9a-zA-Z-_]{8}\.[^\.]*$", RegexOptions.Compiled);
app.UseStaticFiles(new StaticFileOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const coalesceVuetify = createCoalesceVuetify({
// SETUP: app insights
//@ts-expect-error AppInsights imported from backend JavaScriptSnippet; no types available.
window.appInsights?.addTelemetryInitializer(function (envelope) {
debugger;
if (
envelope.baseType === "ExceptionData" &&
// Filter out unactionable, junk errors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ const router = createRouter({
//#if Identity
{
path: "/user/:id",
alias: "/admin/User/edit/:id",
alias: "/admin/User/edit/:id", // Override coalesce admin page
props: true,
component: () => import("./views/UserProfile.vue"),
},
// {
// path: "/admin/User/edit/:id",
// redirect(to) { return `/user/` }
// }
// #endif

// Coalesce admin routes
Expand Down Expand Up @@ -82,7 +78,7 @@ function titledAdminPage<
| typeof CAdminEditorPage
//#if AuditLogs
| typeof CAdminAuditLogPage,
//#endif
//#endif
>(component: T) {
return defineComponent({
setup() {
Expand Down

0 comments on commit 96d30e5

Please sign in to comment.