@ -42,7 +42,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Alias = Aliases.AddAlias(Alias);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Alias Added {Alias}", Alias);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Alias Added {Alias}", Alias);
 | 
			
		||||
            }
 | 
			
		||||
            return Alias;
 | 
			
		||||
        }
 | 
			
		||||
@ -55,7 +55,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Alias = Aliases.UpdateAlias(Alias);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Alias Updated {Alias}", Alias);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Alias Updated {Alias}", Alias);
 | 
			
		||||
            }
 | 
			
		||||
            return Alias;
 | 
			
		||||
        }
 | 
			
		||||
@ -66,7 +66,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Aliases.DeleteAlias(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Alias Deleted {AliasId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Alias Deleted {AliasId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -110,7 +110,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                    {
 | 
			
		||||
                        // rename file now that the entire process is completed
 | 
			
		||||
                        System.IO.File.Move(Path.Combine(folder, filename + ".tmp"), Path.Combine(folder, filename));
 | 
			
		||||
                        logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "File Uploaded {File}", Path.Combine(folder, filename));
 | 
			
		||||
                        logger.Log(LogLevel.Information, this, LogFunction.Create, "File Uploaded {File}", Path.Combine(folder, filename));
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@ -173,7 +173,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (System.IO.File.Exists(file))
 | 
			
		||||
            {
 | 
			
		||||
                System.IO.File.Delete(file);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "File Deleted {File}", file);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Delete, "File Deleted {File}", file);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -279,7 +279,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public GenericResponse Upgrade()
 | 
			
		||||
        {
 | 
			
		||||
            var response = new GenericResponse { Success = true, Message = "" };
 | 
			
		||||
            InstallationManager.InstallPackages("Framework");
 | 
			
		||||
            InstallationManager.InstallPackages("Framework", true);
 | 
			
		||||
            return response;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -76,7 +76,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Module = Modules.AddModule(Module);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Module Added {Module}", Module);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Added {Module}", Module);
 | 
			
		||||
            }
 | 
			
		||||
            return Module;
 | 
			
		||||
        }
 | 
			
		||||
@ -89,7 +89,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Module = Modules.UpdateModule(Module);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Module Updated {Module}", Module);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", Module);
 | 
			
		||||
            }
 | 
			
		||||
            return Module;
 | 
			
		||||
        }
 | 
			
		||||
@ -100,7 +100,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Modules.DeleteModule(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Module Deleted {ModuleId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // GET api/<controller>/export?moduleid=x
 | 
			
		||||
@ -141,7 +141,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        content = JsonSerializer.Serialize(modulecontent);
 | 
			
		||||
                        logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Read, "Module Content Exported {ModuleId}", moduleid);
 | 
			
		||||
                        logger.Log(LogLevel.Information, this, LogFunction.Read, "Module Content Exported {ModuleId}", moduleid);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@ -187,7 +187,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                                            var moduleobject = ActivatorUtilities.CreateInstance(ServiceProvider, moduletype);
 | 
			
		||||
                                            ((IPortable)moduleobject).ImportModule(module, modulecontent.Content, modulecontent.Version);
 | 
			
		||||
                                            success = true;
 | 
			
		||||
                                            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Module Content Imported {ModuleId}", moduleid);
 | 
			
		||||
                                            logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Content Imported {ModuleId}", moduleid);
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                ModuleDefinitions.UpdateModuleDefinition(ModuleDefinition);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Module Definition Updated {ModuleDefinition}", ModuleDefinition);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Definition Updated {ModuleDefinition}", ModuleDefinition);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -60,8 +60,8 @@ namespace Oqtane.Controllers
 | 
			
		||||
        [Authorize(Roles = Constants.HostRole)]
 | 
			
		||||
        public void InstallModules()
 | 
			
		||||
        {
 | 
			
		||||
            InstallationManager.InstallPackages("Modules");
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Modules Installed");
 | 
			
		||||
            InstallationManager.InstallPackages("Modules", true);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Create, "Modules Installed");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // DELETE api/<controller>/5?siteid=x
 | 
			
		||||
@ -88,7 +88,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                ModuleDefinitions.DeleteModuleDefinition(id, siteid);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Module Deleted {ModuleDefinitionId}", id);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleDefinitionId}", id);
 | 
			
		||||
 | 
			
		||||
                InstallationManager.RestartApplication();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Page = Pages.AddPage(Page);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Page Added {Page}", Page);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Added {Page}", Page);
 | 
			
		||||
            }
 | 
			
		||||
            return Page;
 | 
			
		||||
        }
 | 
			
		||||
@ -63,7 +63,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Page = Pages.UpdatePage(Page);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Page Updated {Page}", Page);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Updated {Page}", Page);
 | 
			
		||||
            }
 | 
			
		||||
            return Page;
 | 
			
		||||
        }
 | 
			
		||||
@ -84,7 +84,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                }
 | 
			
		||||
                order += 2;
 | 
			
		||||
            }
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Page Order Updated {SiteId} {ParentId}", siteid, parentid);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Order Updated {SiteId} {ParentId}", siteid, parentid);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // DELETE api/<controller>/5
 | 
			
		||||
@ -93,7 +93,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Pages.DeletePage(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Page Deleted {PageId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Deleted {PageId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                PageModule = PageModules.AddPageModule(PageModule);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Page Module Added {PageModule}", PageModule);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Module Added {PageModule}", PageModule);
 | 
			
		||||
            }
 | 
			
		||||
            return PageModule;
 | 
			
		||||
        }
 | 
			
		||||
@ -65,7 +65,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                PageModule = PageModules.UpdatePageModule(PageModule);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Page Module Updated {PageModule}", PageModule);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Updated {PageModule}", PageModule);
 | 
			
		||||
            }
 | 
			
		||||
            return PageModule;
 | 
			
		||||
        }
 | 
			
		||||
@ -86,7 +86,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                }
 | 
			
		||||
                order += 2;
 | 
			
		||||
            }
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Page Module Order Updated {PageId} {Pane}", pageid, pane);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Order Updated {PageId} {Pane}", pageid, pane);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // DELETE api/<controller>/5
 | 
			
		||||
@ -95,7 +95,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            PageModules.DeletePageModule(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Page Module Deleted {PageModuleId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Module Deleted {PageModuleId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Permission = Permissions.AddPermission(Permission);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Permission Added {Permission}", Permission);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Permission Added {Permission}", Permission);
 | 
			
		||||
            }
 | 
			
		||||
            return Permission;
 | 
			
		||||
        }
 | 
			
		||||
@ -55,7 +55,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Permission = Permissions.UpdatePermission(Permission);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Permission Updated {Permission}", Permission);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Permission Updated {Permission}", Permission);
 | 
			
		||||
            }
 | 
			
		||||
            return Permission;
 | 
			
		||||
        }
 | 
			
		||||
@ -66,7 +66,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Permissions.DeletePermission(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Permission Deleted {PermissionId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Permission Deleted {PermissionId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Profile = Profiles.AddProfile(Profile);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Profile Added {Profile}", Profile);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Profile Added {Profile}", Profile);
 | 
			
		||||
            }
 | 
			
		||||
            return Profile;
 | 
			
		||||
        }
 | 
			
		||||
@ -62,7 +62,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Profile = Profiles.UpdateProfile(Profile);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Profile Updated {Profile}", Profile);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Profile Updated {Profile}", Profile);
 | 
			
		||||
            }
 | 
			
		||||
            return Profile;
 | 
			
		||||
        }
 | 
			
		||||
@ -73,7 +73,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Profiles.DeleteProfile(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Profile Deleted {ProfileId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Profile Deleted {ProfileId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Role = Roles.AddRole(Role);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Role Added {Role}", Role);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Role Added {Role}", Role);
 | 
			
		||||
            }
 | 
			
		||||
            return Role;
 | 
			
		||||
        }
 | 
			
		||||
@ -62,7 +62,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Role = Roles.UpdateRole(Role);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Role Updated {Role}", Role);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Role Updated {Role}", Role);
 | 
			
		||||
            }
 | 
			
		||||
            return Role;
 | 
			
		||||
        }
 | 
			
		||||
@ -73,7 +73,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Roles.DeleteRole(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Role Deleted {RoleId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Role Deleted {RoleId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -45,7 +45,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid && IsAuthorized(Setting.EntityName, Setting.EntityId))
 | 
			
		||||
            {
 | 
			
		||||
                Setting = Settings.AddSetting(Setting);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Setting Added {Setting}", Setting);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Setting Added {Setting}", Setting);
 | 
			
		||||
            }
 | 
			
		||||
            return Setting;
 | 
			
		||||
        }
 | 
			
		||||
@ -58,7 +58,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid && IsAuthorized(Setting.EntityName, Setting.EntityId))
 | 
			
		||||
            {
 | 
			
		||||
                Setting = Settings.UpdateSetting(Setting);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Setting Updated {Setting}", Setting);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Setting Updated {Setting}", Setting);
 | 
			
		||||
            }
 | 
			
		||||
            return Setting;
 | 
			
		||||
        }
 | 
			
		||||
@ -69,7 +69,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Settings.DeleteSetting(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Setting Deleted {SettingId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Setting Deleted {SettingId}", id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool IsAuthorized(string EntityName, int EntityId)
 | 
			
		||||
 | 
			
		||||
@ -67,7 +67,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                    {
 | 
			
		||||
                        Directory.CreateDirectory(folder);
 | 
			
		||||
                    }
 | 
			
		||||
                    logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Site Added {Site}", Site);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this, LogFunction.Create, "Site Added {Site}", Site);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return Site;
 | 
			
		||||
@ -81,7 +81,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Site = Sites.UpdateSite(Site);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Site Updated {Site}", Site);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Site Updated {Site}", Site);
 | 
			
		||||
            }
 | 
			
		||||
            return Site;
 | 
			
		||||
        }
 | 
			
		||||
@ -92,7 +92,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Sites.DeleteSite(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Site Deleted {SiteId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Site Deleted {SiteId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Tenant = Tenants.AddTenant(Tenant);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Tenant Added {TenantId}", Tenant.TenantId);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "Tenant Added {TenantId}", Tenant.TenantId);
 | 
			
		||||
            }
 | 
			
		||||
            return Tenant;
 | 
			
		||||
        }
 | 
			
		||||
@ -57,7 +57,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                Tenant = Tenants.UpdateTenant(Tenant);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Tenant Updated {TenantId}", Tenant.TenantId);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "Tenant Updated {TenantId}", Tenant.TenantId);
 | 
			
		||||
            }
 | 
			
		||||
            return Tenant;
 | 
			
		||||
        }
 | 
			
		||||
@ -68,7 +68,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Tenants.DeleteTenant(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Tenant Deleted {TenantId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "Tenant Deleted {TenantId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -48,8 +48,8 @@ namespace Oqtane.Controllers
 | 
			
		||||
        [Authorize(Roles = Constants.HostRole)]
 | 
			
		||||
        public void InstallThemes()
 | 
			
		||||
        {
 | 
			
		||||
            InstallationManager.InstallPackages("Themes");
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Themes Installed");
 | 
			
		||||
            InstallationManager.InstallPackages("Themes", true);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Create, "Themes Installed");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // DELETE api/<controller>/xxx
 | 
			
		||||
@ -74,7 +74,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                {
 | 
			
		||||
                    System.IO.File.Delete(file);
 | 
			
		||||
                }
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Theme Deleted {ThemeName}", themename);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Deleted {ThemeName}", themename);
 | 
			
		||||
 | 
			
		||||
                InstallationManager.RestartApplication();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -127,7 +127,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                user.Password = ""; // remove sensitive information
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "User Added {User}", user);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "User Added {User}", user);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return user;
 | 
			
		||||
@ -151,7 +151,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                }
 | 
			
		||||
                User = Users.UpdateUser(User);
 | 
			
		||||
                User.Password = ""; // remove sensitive information
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "User Updated {User}", User);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "User Updated {User}", User);
 | 
			
		||||
            }
 | 
			
		||||
            return User;
 | 
			
		||||
        }
 | 
			
		||||
@ -170,7 +170,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                if (result != null)
 | 
			
		||||
                {
 | 
			
		||||
                    Users.DeleteUser(id);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "User Deleted {UserId}", id);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Deleted {UserId}", id);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -193,7 +193,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                        if (user != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            user.IsAuthenticated = true;
 | 
			
		||||
                            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Security, "User Login Successful {Username}", User.Username);
 | 
			
		||||
                            logger.Log(LogLevel.Information, this, LogFunction.Security, "User Login Successful {Username}", User.Username);
 | 
			
		||||
                            if (SetCookie)
 | 
			
		||||
                            {
 | 
			
		||||
                                await IdentitySignInManager.SignInAsync(identityuser, IsPersistent);
 | 
			
		||||
@ -202,7 +202,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        logger.Log(LogLevel.Error, this.GetType().AssemblyQualifiedName, LogFunction.Security, "User Login Failed {Username}", User.Username);
 | 
			
		||||
                        logger.Log(LogLevel.Error, this, LogFunction.Security, "User Login Failed {Username}", User.Username);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@ -216,7 +216,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public async Task Logout([FromBody] User User)
 | 
			
		||||
        {
 | 
			
		||||
            await HttpContext.SignOutAsync(IdentityConstants.ApplicationScheme);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Security, "User Logout {Username}", User.Username);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Security, "User Logout {Username}", User.Username);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // GET api/<controller>/current
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                UserRole = UserRoles.AddUserRole(UserRole);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "User Role Added {UserRole}", UserRole);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", UserRole);
 | 
			
		||||
            }
 | 
			
		||||
            return UserRole;
 | 
			
		||||
        }
 | 
			
		||||
@ -62,7 +62,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
            if (ModelState.IsValid)
 | 
			
		||||
            {
 | 
			
		||||
                UserRole = UserRoles.UpdateUserRole(UserRole);
 | 
			
		||||
                logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "User Role Updated {UserRole}", UserRole);
 | 
			
		||||
                logger.Log(LogLevel.Information, this, LogFunction.Update, "User Role Updated {UserRole}", UserRole);
 | 
			
		||||
            }
 | 
			
		||||
            return UserRole;
 | 
			
		||||
        }
 | 
			
		||||
@ -73,7 +73,7 @@ namespace Oqtane.Controllers
 | 
			
		||||
        public void Delete(int id)
 | 
			
		||||
        {
 | 
			
		||||
            UserRoles.DeleteUserRole(id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "User Role Deleted {UserRoleId}", id);
 | 
			
		||||
            logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Role Deleted {UserRoleId}", id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
{
 | 
			
		||||
    public interface IInstallationManager
 | 
			
		||||
    {
 | 
			
		||||
        void InstallPackages(string Folders);
 | 
			
		||||
        void InstallPackages(string Folders, bool Restart);
 | 
			
		||||
        void RestartApplication();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -6,8 +6,8 @@ namespace Oqtane.Infrastructure
 | 
			
		||||
{
 | 
			
		||||
    public interface ILogManager
 | 
			
		||||
    {
 | 
			
		||||
        void Log(LogLevel Level, string Category, LogFunction Function, string Message, params object[] Args);
 | 
			
		||||
        void Log(LogLevel Level, string Category, LogFunction Function, Exception Exception, string Message, params object[] Args);
 | 
			
		||||
        void Log(LogLevel Level, object Class, LogFunction Function, string Message, params object[] Args);
 | 
			
		||||
        void Log(LogLevel Level, object Class, LogFunction Function, Exception Exception, string Message, params object[] Args);
 | 
			
		||||
        void Log(Log Log);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@ namespace Oqtane.Infrastructure
 | 
			
		||||
            this.environment = environment;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void InstallPackages(string Folders)
 | 
			
		||||
        public void InstallPackages(string Folders, bool Restart)
 | 
			
		||||
        {
 | 
			
		||||
            bool install = false;
 | 
			
		||||
            string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
 | 
			
		||||
@ -73,7 +73,7 @@ namespace Oqtane.Infrastructure
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (install)
 | 
			
		||||
            if (install && Restart)
 | 
			
		||||
            {
 | 
			
		||||
                // restart application
 | 
			
		||||
                RestartApplication();
 | 
			
		||||
 | 
			
		||||
@ -25,12 +25,12 @@ namespace Oqtane.Infrastructure
 | 
			
		||||
            this.Accessor = Accessor;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Log(LogLevel Level, string Category, LogFunction Function, string Message, params object[] Args)
 | 
			
		||||
        public void Log(LogLevel Level, object Class, LogFunction Function, string Message, params object[] Args)
 | 
			
		||||
        {
 | 
			
		||||
            Log(Level, Category, Function, null, Message, Args);
 | 
			
		||||
            Log(Level, Class.GetType().AssemblyQualifiedName, Function, null, Message, Args);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Log(LogLevel Level, string Category, LogFunction Function, Exception Exception, string Message, params object[] Args)
 | 
			
		||||
        public void Log(LogLevel Level, object Class, LogFunction Function, Exception Exception, string Message, params object[] Args)
 | 
			
		||||
        {
 | 
			
		||||
            Alias alias = TenantResolver.GetAlias();
 | 
			
		||||
            Log log = new Log();
 | 
			
		||||
@ -47,8 +47,15 @@ namespace Oqtane.Infrastructure
 | 
			
		||||
                log.Url = request.Scheme.ToString() + "://" + request.Host.ToString() + request.Path.ToString() + request.QueryString.ToString();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            log.Category = Category;
 | 
			
		||||
            log.Feature = Utilities.GetTypeNameLastSegment(Category, 0);
 | 
			
		||||
            if (Class.GetType() != null)
 | 
			
		||||
            {
 | 
			
		||||
                log.Category = Class.GetType().AssemblyQualifiedName;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                log.Category = Class.ToString();
 | 
			
		||||
            }
 | 
			
		||||
            log.Feature = Utilities.GetTypeNameLastSegment(log.Category, 0);
 | 
			
		||||
            log.Function = Enum.GetName(typeof(LogFunction), Function);
 | 
			
		||||
            log.Level = Enum.GetName(typeof(LogLevel), Level);
 | 
			
		||||
            if (Exception != null)
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ namespace Oqtane.Modules.HtmlText.Controllers
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Log(LogLevel.Error, this.GetType().AssemblyQualifiedName, LogFunction.Read, ex, "Get Error {Error}", ex.Message);
 | 
			
		||||
                logger.Log(LogLevel.Error, this, LogFunction.Read, ex, "Get Error {Error}", ex.Message);
 | 
			
		||||
                throw;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -57,13 +57,13 @@ namespace Oqtane.Modules.HtmlText.Controllers
 | 
			
		||||
                if (ModelState.IsValid && HtmlText.ModuleId == EntityId)
 | 
			
		||||
                {
 | 
			
		||||
                    HtmlText = htmltext.AddHtmlText(HtmlText);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Create, "Html/Text Added {HtmlText}", HtmlText);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this, LogFunction.Create, "Html/Text Added {HtmlText}", HtmlText);
 | 
			
		||||
                }
 | 
			
		||||
                return HtmlText;
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Log(LogLevel.Error, this.GetType().AssemblyQualifiedName, LogFunction.Create, ex, "Post Error {Error}", ex.Message);
 | 
			
		||||
                logger.Log(LogLevel.Error, this, LogFunction.Create, ex, "Post Error {Error}", ex.Message);
 | 
			
		||||
                throw;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -78,13 +78,13 @@ namespace Oqtane.Modules.HtmlText.Controllers
 | 
			
		||||
                if (ModelState.IsValid && HtmlText.ModuleId == EntityId)
 | 
			
		||||
                {
 | 
			
		||||
                    HtmlText = htmltext.UpdateHtmlText(HtmlText);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Update, "Html/Text Updated {HtmlText}", HtmlText);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this, LogFunction.Update, "Html/Text Updated {HtmlText}", HtmlText);
 | 
			
		||||
                }
 | 
			
		||||
                return HtmlText;
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Log(LogLevel.Error, this.GetType().AssemblyQualifiedName, LogFunction.Update, ex, "Put Error {Error}", ex.Message);
 | 
			
		||||
                logger.Log(LogLevel.Error, this, LogFunction.Update, ex, "Put Error {Error}", ex.Message);
 | 
			
		||||
                throw;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@ -99,12 +99,12 @@ namespace Oqtane.Modules.HtmlText.Controllers
 | 
			
		||||
                if (id == EntityId)
 | 
			
		||||
                {
 | 
			
		||||
                    htmltext.DeleteHtmlText(id);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this.GetType().AssemblyQualifiedName, LogFunction.Delete, "Html/Text Deleted {HtmlTextId}", id);
 | 
			
		||||
                    logger.Log(LogLevel.Information, this, LogFunction.Delete, "Html/Text Deleted {HtmlTextId}", id);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Log(LogLevel.Error, this.GetType().AssemblyQualifiedName, LogFunction.Delete, ex, "Delete Error {Error}", ex.Message);
 | 
			
		||||
                logger.Log(LogLevel.Error, this, LogFunction.Delete, ex, "Delete Error {Error}", ex.Message);
 | 
			
		||||
                throw;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ namespace Oqtane.Security
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    logger.Log(LogLevel.Error, this.GetType().AssemblyQualifiedName, LogFunction.Security, "User {User} Does Not Have {PermissionName} Permission For {EntityName}:{EntityId}", context.User, requirement.PermissionName, requirement.EntityName, EntityId);
 | 
			
		||||
                    logger.Log(LogLevel.Error, this, LogFunction.Security, "User {User} Does Not Have {PermissionName} Permission For {EntityName}:{EntityId}", context.User, requirement.PermissionName, requirement.EntityName, EntityId);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return Task.CompletedTask;
 | 
			
		||||
 | 
			
		||||
@ -251,7 +251,7 @@ namespace Oqtane.Server
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // install any modules or themes
 | 
			
		||||
            InstallationManager.InstallPackages("Modules,Themes");
 | 
			
		||||
            InstallationManager.InstallPackages("Modules,Themes", false);
 | 
			
		||||
 | 
			
		||||
            app.UseHttpsRedirection();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user