Refactor host user security model, support static assets in modules and themes, module definition permissions and categories, paging control, remove SiteUsers, move seed data from script to site template for installation
This commit is contained in:
@ -4,11 +4,7 @@ using Oqtane.Repository;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.IO.Compression;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Oqtane.Infrastructure;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
@ -16,58 +12,37 @@ namespace Oqtane.Controllers
|
||||
public class ModuleDefinitionController : Controller
|
||||
{
|
||||
private readonly IModuleDefinitionRepository ModuleDefinitions;
|
||||
private readonly IHostApplicationLifetime HostApplicationLifetime;
|
||||
private readonly IWebHostEnvironment environment;
|
||||
private readonly IInstallation Installation;
|
||||
|
||||
public ModuleDefinitionController(IModuleDefinitionRepository ModuleDefinitions, IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
|
||||
public ModuleDefinitionController(IModuleDefinitionRepository ModuleDefinitions, IInstallation Installation)
|
||||
{
|
||||
this.ModuleDefinitions = ModuleDefinitions;
|
||||
this.HostApplicationLifetime = HostApplicationLifetime;
|
||||
this.environment = environment;
|
||||
this.Installation = Installation;
|
||||
}
|
||||
|
||||
// GET: api/<controller>
|
||||
[HttpGet]
|
||||
public IEnumerable<ModuleDefinition> Get()
|
||||
public IEnumerable<ModuleDefinition> Get(string siteid)
|
||||
{
|
||||
return ModuleDefinitions.GetModuleDefinitions();
|
||||
return ModuleDefinitions.GetModuleDefinitions(int.Parse(siteid));
|
||||
}
|
||||
|
||||
// PUT api/<controller>/5
|
||||
[HttpPut("{id}")]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public void Put(int id, [FromBody] ModuleDefinition ModuleDefinition)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
ModuleDefinitions.UpdateModuleDefinition(ModuleDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("install")]
|
||||
[Authorize(Roles = Constants.HostRole)]
|
||||
public void InstallModules()
|
||||
{
|
||||
bool install = false;
|
||||
string modulefolder = Path.Combine(environment.WebRootPath, "Modules");
|
||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
|
||||
// iterate through module packages
|
||||
foreach (string packagename in Directory.GetFiles(modulefolder, "*.nupkg"))
|
||||
{
|
||||
// iterate through files and deploy to appropriate locations
|
||||
using (ZipArchive archive = ZipFile.OpenRead(packagename))
|
||||
{
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
string filename = Path.GetFileName(entry.FullName);
|
||||
switch (Path.GetExtension(filename))
|
||||
{
|
||||
case ".dll":
|
||||
entry.ExtractToFile(Path.Combine(binfolder, filename));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// remove module package
|
||||
System.IO.File.Delete(packagename);
|
||||
install = true;
|
||||
}
|
||||
|
||||
if (install)
|
||||
{
|
||||
// restart application
|
||||
HostApplicationLifetime.StopApplication();
|
||||
}
|
||||
Installation.Install("Modules");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
using System.Linq;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
@ -33,12 +34,23 @@ namespace Oqtane.Controllers
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
[Authorize(Roles = Constants.HostRole)]
|
||||
public Site Post([FromBody] Site Site)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
Site = Sites.AddSite(Site);
|
||||
bool authorized;
|
||||
if (!Sites.GetSites().Any())
|
||||
{
|
||||
authorized = true; // provision initial site during installation
|
||||
}
|
||||
else
|
||||
{
|
||||
authorized = User.IsInRole(Constants.HostRole);
|
||||
}
|
||||
if (authorized)
|
||||
{
|
||||
Site = Sites.AddSite(Site);
|
||||
}
|
||||
}
|
||||
return Site;
|
||||
}
|
||||
|
@ -3,12 +3,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Oqtane.Shared;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.Reflection;
|
||||
using System.IO.Compression;
|
||||
using Oqtane.Infrastructure;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
@ -16,14 +12,12 @@ namespace Oqtane.Controllers
|
||||
public class ThemeController : Controller
|
||||
{
|
||||
private readonly IThemeRepository Themes;
|
||||
private readonly IHostApplicationLifetime HostApplicationLifetime;
|
||||
private readonly IWebHostEnvironment environment;
|
||||
private readonly IInstallation Installation;
|
||||
|
||||
public ThemeController(IThemeRepository Themes, IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
|
||||
public ThemeController(IThemeRepository Themes, IInstallation Installation)
|
||||
{
|
||||
this.Themes = Themes;
|
||||
this.HostApplicationLifetime = HostApplicationLifetime;
|
||||
this.environment = environment;
|
||||
this.Installation = Installation;
|
||||
}
|
||||
|
||||
// GET: api/<controller>
|
||||
@ -37,37 +31,7 @@ namespace Oqtane.Controllers
|
||||
[Authorize(Roles = Constants.HostRole)]
|
||||
public void InstallThemes()
|
||||
{
|
||||
bool install = false;
|
||||
string themefolder = Path.Combine(environment.WebRootPath, "Themes");
|
||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
|
||||
// iterate through theme packages
|
||||
foreach (string packagename in Directory.GetFiles(themefolder, "*.nupkg"))
|
||||
{
|
||||
// iterate through files and deploy to appropriate locations
|
||||
using (ZipArchive archive = ZipFile.OpenRead(packagename))
|
||||
{
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
string filename = Path.GetFileName(entry.FullName);
|
||||
switch (Path.GetExtension(filename))
|
||||
{
|
||||
case ".dll":
|
||||
entry.ExtractToFile(Path.Combine(binfolder, filename));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// remove theme package
|
||||
System.IO.File.Delete(packagename);
|
||||
install = true;
|
||||
}
|
||||
|
||||
if (install)
|
||||
{
|
||||
// restart application
|
||||
HostApplicationLifetime.StopApplication();
|
||||
}
|
||||
Installation.Install("Themes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,16 +16,14 @@ namespace Oqtane.Controllers
|
||||
public class UserController : Controller
|
||||
{
|
||||
private readonly IUserRepository Users;
|
||||
private readonly ISiteUserRepository SiteUsers;
|
||||
private readonly IRoleRepository Roles;
|
||||
private readonly IUserRoleRepository UserRoles;
|
||||
private readonly UserManager<IdentityUser> IdentityUserManager;
|
||||
private readonly SignInManager<IdentityUser> IdentitySignInManager;
|
||||
|
||||
public UserController(IUserRepository Users, ISiteUserRepository SiteUsers, IRoleRepository Roles, IUserRoleRepository UserRoles, UserManager<IdentityUser> IdentityUserManager, SignInManager<IdentityUser> IdentitySignInManager)
|
||||
public UserController(IUserRepository Users, IRoleRepository Roles, IUserRoleRepository UserRoles, UserManager<IdentityUser> IdentityUserManager, SignInManager<IdentityUser> IdentitySignInManager)
|
||||
{
|
||||
this.Users = Users;
|
||||
this.SiteUsers = SiteUsers;
|
||||
this.Roles = Roles;
|
||||
this.UserRoles = UserRoles;
|
||||
this.IdentityUserManager = IdentityUserManager;
|
||||
@ -34,17 +32,9 @@ namespace Oqtane.Controllers
|
||||
|
||||
// GET: api/<controller>?siteid=x
|
||||
[HttpGet]
|
||||
public IEnumerable<User> Get(string siteid)
|
||||
public IEnumerable<User> Get()
|
||||
{
|
||||
List<User> users = new List<User>();
|
||||
IEnumerable<SiteUser> siteusers = SiteUsers.GetSiteUsers(int.Parse(siteid));
|
||||
foreach (SiteUser siteuser in siteusers)
|
||||
{
|
||||
User user = siteuser.User;
|
||||
user.SiteId = siteuser.SiteId;
|
||||
users.Add(user);
|
||||
}
|
||||
return users;
|
||||
return Users.GetUsers();
|
||||
}
|
||||
|
||||
// GET api/<controller>/5?siteid=x
|
||||
@ -55,18 +45,7 @@ namespace Oqtane.Controllers
|
||||
if (user != null)
|
||||
{
|
||||
user.SiteId = int.Parse(siteid);
|
||||
if (!user.IsHost) // host users are part of every site by default
|
||||
{
|
||||
SiteUser siteuser = SiteUsers.GetSiteUser(user.SiteId, id);
|
||||
if (siteuser != null)
|
||||
{
|
||||
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
user.Roles = ";" + Constants.HostRole + ";" + Constants.AdminRole + ";";
|
||||
}
|
||||
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@ -79,22 +58,7 @@ namespace Oqtane.Controllers
|
||||
if (user != null)
|
||||
{
|
||||
user.SiteId = int.Parse(siteid);
|
||||
if (!user.IsHost) // host users are part of every site by default
|
||||
{
|
||||
SiteUser siteuser = SiteUsers.GetSiteUser(user.SiteId, user.UserId);
|
||||
if (siteuser != null)
|
||||
{
|
||||
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
||||
}
|
||||
else
|
||||
{
|
||||
user = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
user.Roles = ";" + Constants.HostRole + ";" + Constants.AdminRole + ";";
|
||||
}
|
||||
user.Roles = GetUserRoles(user.UserId, user.SiteId);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
@ -107,11 +71,12 @@ namespace Oqtane.Controllers
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
//bool installed = true;
|
||||
//if (!Users.GetUsers().Any())
|
||||
//{
|
||||
// installed = false; // during initial installation we need to be able to create the host user
|
||||
//}
|
||||
int hostroleid = -1;
|
||||
if (!Users.GetUsers().Any())
|
||||
{
|
||||
hostroleid = Roles.GetRoles(User.SiteId, true).Where(item => item.Name == Constants.HostRole).FirstOrDefault().RoleId;
|
||||
}
|
||||
|
||||
IdentityUser identityuser = await IdentityUserManager.FindByNameAsync(User.Username);
|
||||
if (identityuser == null)
|
||||
{
|
||||
@ -122,50 +87,45 @@ namespace Oqtane.Controllers
|
||||
if (result.Succeeded)
|
||||
{
|
||||
user = Users.AddUser(User);
|
||||
if (!user.IsHost) // host users are part of every site by default
|
||||
{
|
||||
SiteUser siteuser = new SiteUser();
|
||||
siteuser.SiteId = User.SiteId;
|
||||
siteuser.UserId = user.UserId;
|
||||
SiteUsers.AddSiteUser(siteuser);
|
||||
|
||||
List<Role> roles = Roles.GetRoles(user.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
||||
foreach (Role role in roles)
|
||||
{
|
||||
UserRole userrole = new UserRole();
|
||||
userrole.UserId = user.UserId;
|
||||
userrole.RoleId = role.RoleId;
|
||||
userrole.EffectiveDate = null;
|
||||
userrole.ExpiryDate = null;
|
||||
UserRoles.AddUserRole(userrole);
|
||||
}
|
||||
// assign to host role if this is the initial installation
|
||||
if (hostroleid != -1)
|
||||
{
|
||||
UserRole userrole = new UserRole();
|
||||
userrole.UserId = user.UserId;
|
||||
userrole.RoleId = hostroleid;
|
||||
userrole.EffectiveDate = null;
|
||||
userrole.ExpiryDate = null;
|
||||
UserRoles.AddUserRole(userrole);
|
||||
}
|
||||
|
||||
// add auto assigned roles to user for site
|
||||
List<Role> roles = Roles.GetRoles(user.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
||||
foreach (Role role in roles)
|
||||
{
|
||||
UserRole userrole = new UserRole();
|
||||
userrole.UserId = user.UserId;
|
||||
userrole.RoleId = role.RoleId;
|
||||
userrole.EffectiveDate = null;
|
||||
userrole.ExpiryDate = null;
|
||||
UserRoles.AddUserRole(userrole);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
user = Users.GetUser(User.Username);
|
||||
SiteUser siteuser = SiteUsers.GetSiteUser(User.SiteId, user.UserId);
|
||||
if (siteuser == null)
|
||||
{
|
||||
if (!user.IsHost) // host users are part of every site by default
|
||||
{
|
||||
siteuser = new SiteUser();
|
||||
siteuser.SiteId = User.SiteId;
|
||||
siteuser.UserId = user.UserId;
|
||||
SiteUsers.AddSiteUser(siteuser);
|
||||
|
||||
List<Role> roles = Roles.GetRoles(User.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
||||
foreach (Role role in roles)
|
||||
{
|
||||
UserRole userrole = new UserRole();
|
||||
userrole.UserId = user.UserId;
|
||||
userrole.RoleId = role.RoleId;
|
||||
userrole.EffectiveDate = null;
|
||||
userrole.ExpiryDate = null;
|
||||
UserRoles.AddUserRole(userrole);
|
||||
}
|
||||
}
|
||||
// add auto assigned roles to user for site
|
||||
List<Role> roles = Roles.GetRoles(User.SiteId).Where(item => item.IsAutoAssigned == true).ToList();
|
||||
foreach (Role role in roles)
|
||||
{
|
||||
UserRole userrole = new UserRole();
|
||||
userrole.UserId = user.UserId;
|
||||
userrole.RoleId = role.RoleId;
|
||||
userrole.EffectiveDate = null;
|
||||
userrole.ExpiryDate = null;
|
||||
UserRoles.AddUserRole(userrole);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,13 +148,9 @@ namespace Oqtane.Controllers
|
||||
// DELETE api/<controller>/5?siteid=x
|
||||
[HttpDelete("{id}")]
|
||||
[Authorize(Roles = Constants.AdminRole)]
|
||||
public void Delete(int id, string siteid)
|
||||
public void Delete(int id)
|
||||
{
|
||||
SiteUser siteuser = SiteUsers.GetSiteUser(id, int.Parse(siteid));
|
||||
if (siteuser != null)
|
||||
{
|
||||
SiteUsers.DeleteSiteUser(siteuser.SiteUserId);
|
||||
}
|
||||
Users.DeleteUser(id);
|
||||
}
|
||||
|
||||
// POST api/<controller>/login
|
||||
@ -214,19 +170,8 @@ namespace Oqtane.Controllers
|
||||
user = Users.GetUser(identityuser.UserName);
|
||||
if (user != null)
|
||||
{
|
||||
if (!user.IsHost) // host users are part of every site by default
|
||||
{
|
||||
SiteUser siteuser = SiteUsers.GetSiteUser(User.SiteId, user.UserId);
|
||||
if (siteuser != null)
|
||||
{
|
||||
user.IsAuthenticated = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
user.IsAuthenticated = true;
|
||||
}
|
||||
if (user.IsAuthenticated && SetCookie)
|
||||
user.IsAuthenticated = true;
|
||||
if (SetCookie)
|
||||
{
|
||||
await IdentitySignInManager.SignInAsync(identityuser, IsPersistent);
|
||||
}
|
||||
@ -266,10 +211,14 @@ namespace Oqtane.Controllers
|
||||
private string GetUserRoles(int UserId, int SiteId)
|
||||
{
|
||||
string roles = "";
|
||||
IEnumerable<UserRole> userroles = UserRoles.GetUserRoles(UserId, SiteId);
|
||||
List<UserRole> userroles = UserRoles.GetUserRoles(UserId, SiteId).ToList();
|
||||
foreach (UserRole userrole in userroles)
|
||||
{
|
||||
roles += userrole.Role.Name + ";";
|
||||
if (userrole.Role.Name == Constants.HostRole && userroles.Where(item => item.Role.Name == Constants.AdminRole).FirstOrDefault() == null)
|
||||
{
|
||||
roles += Constants.AdminRole + ";";
|
||||
}
|
||||
}
|
||||
if (roles != "") roles = ";" + roles;
|
||||
return roles;
|
||||
|
@ -19,15 +19,15 @@ namespace Oqtane.Controllers
|
||||
|
||||
// GET: api/<controller>?userid=x
|
||||
[HttpGet]
|
||||
public IEnumerable<UserRole> Get(string userid)
|
||||
public IEnumerable<UserRole> Get(string siteid)
|
||||
{
|
||||
if (userid == "")
|
||||
if (siteid == "")
|
||||
{
|
||||
return UserRoles.GetUserRoles();
|
||||
}
|
||||
else
|
||||
{
|
||||
return UserRoles.GetUserRoles(int.Parse(userid));
|
||||
return UserRoles.GetUserRoles(int.Parse(siteid));
|
||||
}
|
||||
}
|
||||
|
||||
|
7
Oqtane.Server/Infrastructure/IInstallation.cs
Normal file
7
Oqtane.Server/Infrastructure/IInstallation.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Oqtane.Infrastructure
|
||||
{
|
||||
public interface IInstallation
|
||||
{
|
||||
void Install(string Folders);
|
||||
}
|
||||
}
|
72
Oqtane.Server/Infrastructure/Installation.cs
Normal file
72
Oqtane.Server/Infrastructure/Installation.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace Oqtane.Infrastructure
|
||||
{
|
||||
public class Installation : IInstallation
|
||||
{
|
||||
private readonly IHostApplicationLifetime HostApplicationLifetime;
|
||||
private readonly IWebHostEnvironment environment;
|
||||
|
||||
public Installation(IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
|
||||
{
|
||||
this.HostApplicationLifetime = HostApplicationLifetime;
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public void Install(string Folders)
|
||||
{
|
||||
bool install = false;
|
||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
|
||||
foreach (string Folder in Folders.Split(','))
|
||||
{
|
||||
string folder = Path.Combine(environment.WebRootPath, Folder);
|
||||
|
||||
// iterate through theme packages
|
||||
foreach (string packagename in Directory.GetFiles(folder, "*.nupkg"))
|
||||
{
|
||||
string name = Path.GetFileNameWithoutExtension(packagename);
|
||||
string[] segments = name.Split('.');
|
||||
name = string.Join('.', segments, 0, segments.Length - 3);
|
||||
|
||||
// iterate through files and deploy to appropriate locations
|
||||
using (ZipArchive archive = ZipFile.OpenRead(packagename))
|
||||
{
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
string filename = Path.GetFileName(entry.FullName);
|
||||
switch (Path.GetExtension(filename))
|
||||
{
|
||||
case ".dll":
|
||||
entry.ExtractToFile(Path.Combine(binfolder, filename), true);
|
||||
break;
|
||||
case ".png":
|
||||
case ".jpg":
|
||||
case ".jpeg":
|
||||
case ".gif":
|
||||
case ".svg":
|
||||
case ".js":
|
||||
case ".css":
|
||||
entry.ExtractToFile(folder + "\\" + entry.FullName.Replace("wwwroot", name).Replace("/","\\"), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// remove package
|
||||
File.Delete(packagename);
|
||||
install = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (install)
|
||||
{
|
||||
// restart application
|
||||
HostApplicationLifetime.StopApplication();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ namespace Oqtane.Repository
|
||||
|
||||
public virtual DbSet<Alias> Alias { get; set; }
|
||||
public virtual DbSet<Tenant> Tenant { get; set; }
|
||||
public virtual DbSet<ModuleDefinition> ModuleDefinition { get; set; }
|
||||
|
||||
public override int SaveChanges()
|
||||
{
|
||||
|
@ -12,7 +12,6 @@ namespace Oqtane.Repository
|
||||
public virtual DbSet<Module> Module { get; set; }
|
||||
public virtual DbSet<User> User { get; set; }
|
||||
public virtual DbSet<Profile> Profile { get; set; }
|
||||
public virtual DbSet<SiteUser> SiteUser { get; set; }
|
||||
public virtual DbSet<Role> Role { get; set; }
|
||||
public virtual DbSet<UserRole> UserRole { get; set; }
|
||||
public virtual DbSet<Permission> Permission { get; set; }
|
||||
|
@ -5,6 +5,8 @@ namespace Oqtane.Repository
|
||||
{
|
||||
public interface IModuleDefinitionRepository
|
||||
{
|
||||
IEnumerable<ModuleDefinition> GetModuleDefinitions();
|
||||
IEnumerable<ModuleDefinition> GetModuleDefinitions(int SideId);
|
||||
void UpdateModuleDefinition(ModuleDefinition ModuleDefinition);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public interface ISiteUserRepository
|
||||
{
|
||||
IEnumerable<SiteUser> GetSiteUsers();
|
||||
IEnumerable<SiteUser> GetSiteUsers(int SiteId);
|
||||
SiteUser AddSiteUser(SiteUser SiteUser);
|
||||
SiteUser UpdateSiteUser(SiteUser SiteUser);
|
||||
SiteUser GetSiteUser(int SiteUserId);
|
||||
SiteUser GetSiteUser(int SiteId, int UserId);
|
||||
void DeleteSiteUser(int SiteUserId);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace Oqtane.Repository
|
||||
public interface IUserRoleRepository
|
||||
{
|
||||
IEnumerable<UserRole> GetUserRoles();
|
||||
IEnumerable<UserRole> GetUserRoles(int UserId);
|
||||
IEnumerable<UserRole> GetUserRoles(int SiteId);
|
||||
IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId);
|
||||
UserRole AddUserRole(UserRole UserRole);
|
||||
UserRole UpdateUserRole(UserRole UserRole);
|
||||
|
@ -10,14 +10,16 @@ namespace Oqtane.Repository
|
||||
{
|
||||
public class ModuleDefinitionRepository : IModuleDefinitionRepository
|
||||
{
|
||||
private readonly List<ModuleDefinition> ModuleDefinitions;
|
||||
private MasterDBContext db;
|
||||
private readonly IPermissionRepository Permissions;
|
||||
|
||||
public ModuleDefinitionRepository()
|
||||
public ModuleDefinitionRepository(MasterDBContext context, IPermissionRepository Permissions)
|
||||
{
|
||||
ModuleDefinitions = LoadModuleDefinitions();
|
||||
db = context;
|
||||
this.Permissions = Permissions;
|
||||
}
|
||||
|
||||
private List<ModuleDefinition> LoadModuleDefinitions()
|
||||
private List<ModuleDefinition> LoadModuleDefinitions(int SiteId)
|
||||
{
|
||||
List<ModuleDefinition> ModuleDefinitions = new List<ModuleDefinition>();
|
||||
|
||||
@ -29,6 +31,27 @@ namespace Oqtane.Repository
|
||||
ModuleDefinitions = LoadModuleDefinitionsFromAssembly(ModuleDefinitions, assembly);
|
||||
}
|
||||
|
||||
// sync module definitions with database
|
||||
List<ModuleDefinition> moduledefs = db.ModuleDefinition.ToList();
|
||||
foreach (ModuleDefinition moduledefinition in ModuleDefinitions)
|
||||
{
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "ModuleDefinition").ToList();
|
||||
ModuleDefinition moduledef = moduledefs.Where(item => item.ModuleDefinitionName == moduledefinition.ModuleDefinitionName).FirstOrDefault();
|
||||
if (moduledef == null)
|
||||
{
|
||||
moduledef = new ModuleDefinition { ModuleDefinitionName = moduledefinition.ModuleDefinitionName };
|
||||
db.ModuleDefinition.Add(moduledef);
|
||||
db.SaveChanges();
|
||||
}
|
||||
moduledefinition.ModuleDefinitionId = moduledef.ModuleDefinitionId;
|
||||
moduledefinition.SiteId = SiteId;
|
||||
moduledefinition.Permissions = Permissions.EncodePermissions(moduledefinition.ModuleDefinitionId, permissions);
|
||||
moduledefinition.CreatedBy = moduledef.CreatedBy;
|
||||
moduledefinition.CreatedOn = moduledef.CreatedOn;
|
||||
moduledefinition.ModifiedBy = moduledef.ModifiedBy;
|
||||
moduledefinition.ModifiedOn = moduledef.ModifiedOn;
|
||||
}
|
||||
|
||||
return ModuleDefinitions;
|
||||
}
|
||||
|
||||
@ -64,13 +87,14 @@ namespace Oqtane.Repository
|
||||
ModuleDefinitionName = QualifiedModuleType,
|
||||
Name = GetProperty(properties, "Name"),
|
||||
Description = GetProperty(properties, "Description"),
|
||||
Categories = GetProperty(properties, "Categories"),
|
||||
Version = GetProperty(properties, "Version"),
|
||||
Owner = GetProperty(properties, "Owner"),
|
||||
Url = GetProperty(properties, "Url"),
|
||||
Contact = GetProperty(properties, "Contact"),
|
||||
License = GetProperty(properties, "License"),
|
||||
Dependencies = GetProperty(properties, "Dependencies"),
|
||||
Permissions = GetProperty(properties, "Permissions"),
|
||||
PermissionNames = GetProperty(properties, "PermissionNames"),
|
||||
ControlTypeTemplate = ModuleType + ".{Control}" + ", " + typename[1],
|
||||
ControlTypeRoutes = "",
|
||||
AssemblyName = assembly.FullName.Split(",")[0]
|
||||
@ -83,13 +107,14 @@ namespace Oqtane.Repository
|
||||
ModuleDefinitionName = QualifiedModuleType,
|
||||
Name = ModuleType.Substring(ModuleType.LastIndexOf(".") + 1),
|
||||
Description = ModuleType.Substring(ModuleType.LastIndexOf(".") + 1),
|
||||
Categories = ((QualifiedModuleType.StartsWith("Oqtane.Modules.Admin.")) ? "Admin" : ""),
|
||||
Version = new Version(1, 0, 0).ToString(),
|
||||
Owner = "",
|
||||
Url = "",
|
||||
Contact = "",
|
||||
License = "",
|
||||
Dependencies = "",
|
||||
Permissions = "",
|
||||
PermissionNames = "",
|
||||
ControlTypeTemplate = ModuleType + ".{Control}" + ", " + typename[1],
|
||||
ControlTypeRoutes = "",
|
||||
AssemblyName = assembly.FullName.Split(",")[0]
|
||||
@ -116,11 +141,6 @@ namespace Oqtane.Repository
|
||||
return moduledefinitions;
|
||||
}
|
||||
|
||||
public IEnumerable<ModuleDefinition> GetModuleDefinitions()
|
||||
{
|
||||
return ModuleDefinitions;
|
||||
}
|
||||
|
||||
private string GetProperty(Dictionary<string, string> Properties, string Key)
|
||||
{
|
||||
string Value = "";
|
||||
@ -130,5 +150,15 @@ namespace Oqtane.Repository
|
||||
}
|
||||
return Value;
|
||||
}
|
||||
|
||||
public IEnumerable<ModuleDefinition> GetModuleDefinitions(int SiteId)
|
||||
{
|
||||
return LoadModuleDefinitions(SiteId);
|
||||
}
|
||||
|
||||
public void UpdateModuleDefinition(ModuleDefinition ModuleDefinition)
|
||||
{
|
||||
Permissions.UpdatePermissions(ModuleDefinition.SiteId, "ModuleDefinition", ModuleDefinition.ModuleDefinitionId, ModuleDefinition.Permissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,18 +2,56 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
using System;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public class SiteRepository : ISiteRepository
|
||||
{
|
||||
private TenantDBContext db;
|
||||
private readonly TenantDBContext db;
|
||||
private readonly IRoleRepository RoleRepository;
|
||||
private readonly IProfileRepository ProfileRepository;
|
||||
private readonly IPageRepository PageRepository;
|
||||
private readonly IModuleRepository ModuleRepository;
|
||||
private readonly IPageModuleRepository PageModuleRepository;
|
||||
private readonly List<PageTemplate> SiteTemplate;
|
||||
|
||||
public SiteRepository(TenantDBContext context)
|
||||
public SiteRepository(TenantDBContext context, IRoleRepository RoleRepository, IProfileRepository ProfileRepository, IPageRepository PageRepository, IModuleRepository ModuleRepository, IPageModuleRepository PageModuleRepository)
|
||||
{
|
||||
db = context;
|
||||
this.RoleRepository = RoleRepository;
|
||||
this.ProfileRepository = ProfileRepository;
|
||||
this.PageRepository = PageRepository;
|
||||
this.ModuleRepository = ModuleRepository;
|
||||
this.PageModuleRepository = PageModuleRepository;
|
||||
|
||||
// defines the default site template
|
||||
SiteTemplate = new List<PageTemplate>();
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Home", Parent = "", Path = "", Order = 1, Icon = "home", IsNavigation = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "", ModulePermissions = "", Title = "", Pane = "", ContainerType = "" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Admin", Parent = "", Path = "admin", Order = 1, Icon = "", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Dashboard, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Administration", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Site Management", Parent = "Admin", Path = "admin/sites", Order = 1, Icon = "globe", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Sites, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Site Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Page Management", Parent = "Admin", Path = "admin/pages", Order = 1, Icon = "layers", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Pages, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Page Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Module Management", Parent = "Admin", Path = "admin/modules", Order = 1, Icon = "browser", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.ModuleDefinitions, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Module Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Theme Management", Parent = "Admin", Path = "admin/themes", Order = 1, Icon = "brush", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Themes, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Theme Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "User Management", Parent = "Admin", Path = "admin/users", Order = 1, Icon = "person", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Users, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Role Management", Parent = "Admin", Path = "admin/roles", Order = 1, Icon = "lock-locked", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Roles, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Role Management", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Login", Parent = "", Path = "login", Order = 1, Icon = "lock-locked", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Login, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Login", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Register", Parent = "", Path = "register", Order = 1, Icon = "person", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Register, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Register", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
SiteTemplate.Add(new PageTemplate { Name = "Profile", Parent = "", Path = "profile", Order = 1, Icon = "person", IsNavigation = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
|
||||
ModuleDefinitionName = "Oqtane.Modules.Admin.Profile, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Profile", Pane = "top", ContainerType = "Oqtane.Themes.Theme2.Container2, Oqtane.Client" });
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Site> GetSites()
|
||||
{
|
||||
return db.Site;
|
||||
@ -23,6 +61,7 @@ namespace Oqtane.Repository
|
||||
{
|
||||
db.Site.Add(Site);
|
||||
db.SaveChanges();
|
||||
CreateSite(Site);
|
||||
return Site;
|
||||
}
|
||||
|
||||
@ -44,5 +83,74 @@ namespace Oqtane.Repository
|
||||
db.Site.Remove(site);
|
||||
db.SaveChanges();
|
||||
}
|
||||
|
||||
private void CreateSite(Site site)
|
||||
{
|
||||
RoleRepository.AddRole(new Role { SiteId = null, Name = Constants.AllUsersRole, Description = "All Users", IsAutoAssigned = false, IsSystem = true });
|
||||
RoleRepository.AddRole(new Role { SiteId = null, Name = Constants.HostRole, Description = "Application Administrators", IsAutoAssigned = false, IsSystem = true });
|
||||
|
||||
RoleRepository.AddRole(new Role { SiteId = site.SiteId, Name = Constants.RegisteredRole, Description = "Registered Users", IsAutoAssigned = true, IsSystem = true });
|
||||
RoleRepository.AddRole(new Role { SiteId = site.SiteId, Name = Constants.AdminRole, Description = "Site Administrators", IsAutoAssigned = false, IsSystem = true });
|
||||
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "FirstName", Title = "First Name", Description = "Your First Or Given Name", Category = "Name", ViewOrder = 1, MaxLength = 50, DefaultValue = "", IsRequired = true, IsPrivate = false });
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "LastName", Title = "Last Name", Description = "Your Last Or Family Name", Category = "Name", ViewOrder = 2, MaxLength = 50, DefaultValue = "", IsRequired = true, IsPrivate = false });
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "Street", Title = "Street", Description = "Street Or Building Address", Category = "Address", ViewOrder = 3, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "City", Title = "City", Description = "City", Category = "Address", ViewOrder = 4, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "Region", Title = "Region", Description = "State Or Province", Category = "Address", ViewOrder = 5, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "Country", Title = "Country", Description = "Country", Category = "Address", ViewOrder = 6, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "PostalCode", Title = "Postal Code", Description = "Postal Code Or Zip Code", Category = "Address", ViewOrder = 7, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||
ProfileRepository.AddProfile(new Profile { SiteId = site.SiteId, Name = "Phone", Title = "Phone Number", Description = "Phone Number", Category = "Contact", ViewOrder = 8, MaxLength = 50, DefaultValue = "", IsRequired = false, IsPrivate = false });
|
||||
|
||||
foreach (PageTemplate pagetemplate in SiteTemplate)
|
||||
{
|
||||
int? parentid = null;
|
||||
if (pagetemplate.Parent != "")
|
||||
{
|
||||
List<Page> pages = PageRepository.GetPages(site.SiteId).ToList();
|
||||
Page parent = pages.Where(item => item.Name == pagetemplate.Parent).FirstOrDefault();
|
||||
parentid = parent.PageId;
|
||||
}
|
||||
|
||||
Page page = new Page
|
||||
{
|
||||
SiteId = site.SiteId,
|
||||
ParentId = parentid,
|
||||
Name = pagetemplate.Name,
|
||||
Path = pagetemplate.Path,
|
||||
Order = pagetemplate.Order,
|
||||
IsNavigation = pagetemplate.IsNavigation,
|
||||
ThemeType = site.DefaultThemeType,
|
||||
LayoutType = site.DefaultLayoutType,
|
||||
Icon = pagetemplate.Icon,
|
||||
Permissions = pagetemplate.PagePermissions
|
||||
};
|
||||
Type type = Type.GetType(page.ThemeType);
|
||||
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
|
||||
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
|
||||
page = PageRepository.AddPage(page);
|
||||
|
||||
if (pagetemplate.ModuleDefinitionName != "")
|
||||
{
|
||||
Module module = new Module
|
||||
{
|
||||
SiteId = site.SiteId,
|
||||
ModuleDefinitionName = pagetemplate.ModuleDefinitionName,
|
||||
Permissions = pagetemplate.ModulePermissions,
|
||||
};
|
||||
module = ModuleRepository.AddModule(module);
|
||||
|
||||
PageModule pagemodule = new PageModule
|
||||
{
|
||||
PageId = page.PageId,
|
||||
ModuleId = module.ModuleId,
|
||||
Title = pagetemplate.Title,
|
||||
Pane = pagetemplate.Pane,
|
||||
Order = 1,
|
||||
ContainerType = pagetemplate.ContainerType
|
||||
};
|
||||
PageModuleRepository.AddPageModule(pagemodule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public class SiteUserRepository : ISiteUserRepository
|
||||
{
|
||||
private TenantDBContext db;
|
||||
|
||||
public SiteUserRepository(TenantDBContext context)
|
||||
{
|
||||
db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<SiteUser> GetSiteUsers()
|
||||
{
|
||||
return db.SiteUser;
|
||||
}
|
||||
public IEnumerable<SiteUser> GetSiteUsers(int SiteId)
|
||||
{
|
||||
return db.SiteUser.Where(item => item.SiteId == SiteId)
|
||||
.Include(item => item.User); // eager load users
|
||||
}
|
||||
|
||||
public SiteUser AddSiteUser(SiteUser SiteUser)
|
||||
{
|
||||
db.SiteUser.Add(SiteUser);
|
||||
db.SaveChanges();
|
||||
return SiteUser;
|
||||
}
|
||||
|
||||
public SiteUser UpdateSiteUser(SiteUser SiteUser)
|
||||
{
|
||||
db.Entry(SiteUser).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return SiteUser;
|
||||
}
|
||||
|
||||
public SiteUser GetSiteUser(int SiteUserId)
|
||||
{
|
||||
return db.SiteUser.Include(item => item.User) // eager load users
|
||||
.SingleOrDefault(item => item.SiteUserId == SiteUserId);
|
||||
}
|
||||
|
||||
public SiteUser GetSiteUser(int SiteId, int UserId)
|
||||
{
|
||||
return db.SiteUser.Where(item => item.SiteId == SiteId)
|
||||
.Where(item => item.UserId == UserId).FirstOrDefault();
|
||||
}
|
||||
|
||||
public void DeleteSiteUser(int SiteUserId)
|
||||
{
|
||||
SiteUser SiteUser = db.SiteUser.Find(SiteUserId);
|
||||
db.SiteUser.Remove(SiteUser);
|
||||
db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
@ -10,13 +10,6 @@ namespace Oqtane.Repository
|
||||
{
|
||||
public class ThemeRepository : IThemeRepository
|
||||
{
|
||||
private readonly List<Theme> Themes;
|
||||
|
||||
public ThemeRepository()
|
||||
{
|
||||
Themes = LoadThemes();
|
||||
}
|
||||
|
||||
private List<Theme> LoadThemes()
|
||||
{
|
||||
List<Theme> Themes = new List<Theme>();
|
||||
@ -119,11 +112,6 @@ namespace Oqtane.Repository
|
||||
return themes;
|
||||
}
|
||||
|
||||
public IEnumerable<Theme> GetThemes()
|
||||
{
|
||||
return Themes;
|
||||
}
|
||||
|
||||
private string GetProperty(Dictionary<string, string> Properties, string Key)
|
||||
{
|
||||
string Value = "";
|
||||
@ -133,5 +121,10 @@ namespace Oqtane.Repository
|
||||
}
|
||||
return Value;
|
||||
}
|
||||
|
||||
public IEnumerable<Theme> GetThemes()
|
||||
{
|
||||
return LoadThemes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,17 +18,20 @@ namespace Oqtane.Repository
|
||||
{
|
||||
return db.UserRole;
|
||||
}
|
||||
public IEnumerable<UserRole> GetUserRoles(int UserId)
|
||||
public IEnumerable<UserRole> GetUserRoles(int SiteId)
|
||||
{
|
||||
return db.UserRole.Where(item => item.UserId == UserId)
|
||||
.Include(item => item.Role); // eager load roles
|
||||
return db.UserRole
|
||||
.Include(item => item.Role) // eager load roles
|
||||
.Include(item => item.User) // eager load users
|
||||
.Where(item => item.Role.SiteId == SiteId);
|
||||
}
|
||||
|
||||
public IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId)
|
||||
{
|
||||
return db.UserRole.Where(item => item.UserId == UserId)
|
||||
.Include(item => item.Role) // eager load roles
|
||||
.Where(item => item.Role.SiteId == SiteId);
|
||||
.Include(item => item.User) // eager load users
|
||||
.Where(item => item.Role.SiteId == SiteId || item.Role.SiteId == null);
|
||||
}
|
||||
|
||||
public UserRole AddUserRole(UserRole UserRole)
|
||||
@ -47,7 +50,9 @@ namespace Oqtane.Repository
|
||||
|
||||
public UserRole GetUserRole(int UserRoleId)
|
||||
{
|
||||
return db.UserRole.Include(item => item.Role) // eager load roles
|
||||
return db.UserRole
|
||||
.Include(item => item.Role) // eager load roles
|
||||
.Include(item => item.User) // eager load users
|
||||
.SingleOrDefault(item => item.UserRoleId == UserRoleId);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,8 @@ CREATE TABLE [dbo].[Site](
|
||||
[SiteId] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Name] [nvarchar](200) NOT NULL,
|
||||
[Logo] [nvarchar](50) NOT NULL,
|
||||
[DefaultThemeType] [nvarchar](200) NULL,
|
||||
[DefaultThemeType] [nvarchar](200) NOT NULL,
|
||||
[DefaultLayoutType] [nvarchar](200) NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
@ -83,7 +84,6 @@ CREATE TABLE [dbo].[User](
|
||||
[Username] [nvarchar](256) NOT NULL,
|
||||
[DisplayName] [nvarchar](50) NOT NULL,
|
||||
[Email] [nvarchar](256) NOT NULL,
|
||||
[IsHost] [bit] NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
@ -95,21 +95,6 @@ CREATE TABLE [dbo].[User](
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[SiteUser](
|
||||
[SiteUserId] [int] IDENTITY(1,1) NOT NULL,
|
||||
[SiteId] [int] NOT NULL,
|
||||
[UserId] [int] NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
[ModifiedOn] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_SiteUser] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SiteUserId] ASC
|
||||
)
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[Role](
|
||||
[RoleId] [int] IDENTITY(1,1) NOT NULL,
|
||||
[SiteId] [int] NULL,
|
||||
@ -245,20 +230,6 @@ REFERENCES [dbo].[Page] ([PageId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[SiteUser] WITH CHECK ADD CONSTRAINT [FK_SiteUser_Site] FOREIGN KEY([SiteId])
|
||||
REFERENCES [dbo].[Site] ([SiteId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[SiteUser] WITH CHECK ADD CONSTRAINT [FK_SiteUser_User] FOREIGN KEY([UserId])
|
||||
REFERENCES [dbo].[User] ([UserId])
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[HtmlText] WITH CHECK ADD CONSTRAINT [FK_HtmlText_Module] FOREIGN KEY([ModuleId])
|
||||
REFERENCES [dbo].[Module] ([ModuleId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[Role] WITH CHECK ADD CONSTRAINT [FK_Role_Site] FOREIGN KEY ([SiteId])
|
||||
REFERENCES [dbo].[Site] ([SiteId])
|
||||
ON DELETE CASCADE
|
||||
@ -291,6 +262,12 @@ REFERENCES [dbo].[Site] ([SiteId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[HtmlText] WITH CHECK ADD CONSTRAINT [FK_HtmlText_Module] FOREIGN KEY([ModuleId])
|
||||
REFERENCES [dbo].[Module] ([ModuleId])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Create indexes
|
||||
@ -311,13 +288,6 @@ CREATE UNIQUE NONCLUSTERED INDEX IX_User ON dbo.[User]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE UNIQUE NONCLUSTERED INDEX IX_SiteUser ON dbo.SiteUser
|
||||
(
|
||||
SiteId,
|
||||
UserId
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Permission ON dbo.Permission
|
||||
(
|
||||
SiteId,
|
||||
@ -343,482 +313,3 @@ CREATE UNIQUE NONCLUSTERED INDEX IX_UserRole ON dbo.UserRole
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
/*
|
||||
|
||||
Create seed data
|
||||
|
||||
*/
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[Site] ON
|
||||
GO
|
||||
INSERT [dbo].[Site] ([SiteId], [Name], [Logo], [DefaultThemeType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, N'Site1', N'oqtane.png', N'Oqtane.Themes.Theme1.Theme1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Site] ([SiteId], [Name], [Logo], [DefaultThemeType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, N'Site2', N'oqtane.png', N'Oqtane.Themes.Theme1.Theme1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Site] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[Role] ON
|
||||
GO
|
||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (-1, null, N'All Users', N'All Users', 0, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (0, null, N'Host Users', N'Host Users', 0, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, 1, N'Administrators', N'Site Administrators', 0, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, 1, N'Registered Users', N'Registered Users', 1, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (3, 2, N'Administrators', N'Site Administrators', 0, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Role] ([RoleId], [SiteId], [Name], [Description], [IsAutoAssigned], [IsSystem], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (4, 2, N'Registered Users', N'Registered Users', 1, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Role] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[Profile] ON
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, null, 'FirstName', 'First Name', 'Your First Or Given Name', 'Name', 1, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, null, 'LastName', 'Last Name', 'Your Last Or family Name', 'Name', 2, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (3, null, 'Street', 'Street', 'Street Or Building Address', 'Address', 3, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (4, null, 'City', 'City', 'City', 'Address', 4, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (5, null, 'Region', 'Region', 'State Or Province', 'Address', 5, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (6, null, 'Country', 'Country', 'Country', 'Address', 6, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (7, null, 'PostalCode', 'Postal Code', 'Postal Code Or Zip Code', 'Address', 7, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Profile]([ProfileId], [SiteId], [Name], [Title], [Description], [Category], [ViewOrder], [MaxLength], [DefaultValue], [IsRequired], [IsPrivate], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (8, null, 'Phone', 'Phone Number', 'Phone Number', 'Contact', 8, 50, '', 1, 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Profile] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[Page] ON
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, 1, N'Page1', N'', N'Oqtane.Themes.Theme1.Theme1, Oqtane.Client', N'oi-home', N'Left;Right', NULL, 1, 1, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 1, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 1, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 1, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, 1, N'Page2', N'page2', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-plus', N'Top;Bottom', NULL, 3, 1, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 2, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 2, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (3, 1, N'Page3', N'page3', N'Oqtane.Themes.Theme3.Theme3, Oqtane.Client', N'oi-list-rich', N'Left;Right', NULL, 5, 1, N'Oqtane.Themes.Theme3.HorizontalLayout, Oqtane.Client', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 3, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 3, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 3, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (4, 1, N'Admin', N'admin', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 7, 0, N'', '', 1, getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 4, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 4, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (8, 1, N'Site Management', N'admin/sites', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 1, 0, N'', 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 8, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 8, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (5, 1, N'Page Management', N'admin/pages', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 3, 0, N'', 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 5, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 5, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (10, 1, N'Module Management', N'admin/modules', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 5, 0, N'', 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 10, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 10, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (11, 1, N'Theme Management', N'admin/themes', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 7, 0, N'', 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 11, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 11, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (9, 1, N'User Management', N'admin/users', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 9, 0, N'', 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 9, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 9, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (16, 1, N'Role Management', N'admin/roles', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 11, 0, N'', 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 16, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 16, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (6, 1, N'Login', N'login', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 7, 0, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 6, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 6, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 6, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (7, 1, N'Register', N'register', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 9, 0, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 7, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 7, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 7, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (17, 1, N'Profile', N'profile', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 11, 0, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 17, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 17, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 17, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (12, 2, N'Page1', N'', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 1, 1, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 12, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 12, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 12, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (13, 2, N'Page2', N'page2', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 3, 1, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 13, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 13, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 13, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (14, 2, N'Login', N'login', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 5, 0, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 14, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 14, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 14, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (15, 2, N'Register', N'register', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', NULL, 7, 0, N'', 0, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 15, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 15, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Page', 15, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Page] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[Module] ON
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, 1, N'Oqtane.Modules.Weather, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 1, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 1, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 1, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, 1, N'Oqtane.Modules.Counter, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 2, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 2, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 2, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (3, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 3, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 3, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 3, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (4, 1, N'Oqtane.Modules.Weather, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 4, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 4, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 4, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (5, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 5, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 5, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 5, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (6, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 6, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 6, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 6, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (7, 1, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 7, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 7, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (8, 1, N'Oqtane.Modules.Admin.Pages, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 8, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 8, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (9, 1, N'Oqtane.Modules.Admin.Login, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 9, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 9, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 9, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (10, 1, N'Oqtane.Modules.Admin.Register, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 10, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 10, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 10, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (11, 1, N'Oqtane.Modules.Admin.Dashboard, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 11, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 11, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (12, 1, N'Oqtane.Modules.Admin.Sites, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 12, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 12, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (13, 1, N'Oqtane.Modules.Admin.Users, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 13, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 13, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (14, 1, N'Oqtane.Modules.Admin.ModuleDefinitions, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 14, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 14, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (15, 1, N'Oqtane.Modules.Admin.Themes, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 15, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 15, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (16, 2, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 16, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 16, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 16, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (17, 2, N'Oqtane.Modules.HtmlText, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 17, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 17, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 17, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (18, 2, N'Oqtane.Modules.Admin.Login, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 18, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 18, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 18, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (19, 2, N'Oqtane.Modules.Admin.Register, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 19, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 19, 'View', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (2, 'Module', 19, 'Edit', 3, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (20, 1, N'Oqtane.Modules.Admin.Roles, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 20, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 20, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Module] ([ModuleId], [SiteId], [ModuleDefinitionName], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (21, 1, N'Oqtane.Modules.Admin.Profile, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 21, 'View', -1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 21, 'View', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Module', 21, 'Edit', 1, null, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Module] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[PageModule] ON
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, 1, 1, N'Weather', N'Right', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, 1, 2, N'Counter', N'Left', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (3, 1, 3, N'Lorem ipsum', N'Left', 3, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (4, 2, 4, N'Weather', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (5, 2, 5, N'Enim sed', N'Top', 3, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (6, 3, 6, N'Id consectetur', N'Left', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (7, 3, 7, N'Ornare arcu', N'Right', 1, N'Oqtane.Themes.Theme1.Container1, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (8, 5, 8, N'Page Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (9, 6, 9, N'Login', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (10, 7, 10, N'Register', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (11, 4, 11, N'Administration', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (12, 8, 12, N'Site Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (13, 9, 13, N'User Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (14, 10, 14, N'Module Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (15, 11, 15, N'Theme Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (16, 12, 16, N'Id consectetur', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (17, 13, 17, N'Lorem ipsum', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (18, 14, 18, N'Login', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (19, 15, 19, N'Register', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (20, 16, 20, N'Role Management', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[PageModule] ([PageModuleId], [PageId], [ModuleId], [Title], [Pane], [Order], [ContainerType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (21, 17, 21, N'User Profile', N'Top', 1, N'Oqtane.Themes.Theme2.Container2, Oqtane.Client', '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[PageModule] OFF
|
||||
GO
|
||||
|
||||
SET IDENTITY_INSERT [dbo].[HtmlText] ON
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, 3, N'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <br /><br /><a href="http://localhost:44357/site2/">Go To Site2</a>', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, 5, N'Enim sed faucibus turpis in eu mi bibendum neque egestas. Quis hendrerit dolor magna eget est lorem. Dui faucibus in ornare quam viverra orci sagittis. Integer eget aliquet nibh praesent tristique magna sit. Nunc aliquet bibendum enim facilisis gravida neque convallis a cras. Tortor id aliquet lectus proin. Diam volutpat commodo sed egestas egestas fringilla. Posuere sollicitudin aliquam ultrices sagittis orci. Viverra mauris in aliquam sem fringilla ut morbi tincidunt. Eget gravida cum sociis natoque penatibus et. Sagittis orci a scelerisque purus semper. Eget velit aliquet sagittis id consectetur purus. Volutpat blandit aliquam etiam erat. Et tortor consequat id porta nibh venenatis cras. Volutpat odio facilisis mauris sit amet. Varius duis at consectetur lorem.', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (3, 6, N'Id consectetur purus ut faucibus pulvinar elementum integer. Bibendum neque egestas congue quisque egestas diam in arcu. Eget nullam non nisi est sit amet facilisis. Sit amet consectetur adipiscing elit pellentesque. Id aliquet risus feugiat in. Enim blandit volutpat maecenas volutpat blandit aliquam etiam erat. Commodo odio aenean sed adipiscing. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Aliquet enim tortor at auctor urna nunc. Nulla pellentesque dignissim enim sit amet. Suscipit adipiscing bibendum est ultricies integer quis auctor. Lacinia quis vel eros donec ac odio tempor. Aliquam vestibulum morbi blandit cursus risus at.', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (4, 7, N'Ornare arcu dui vivamus arcu felis bibendum ut. Tortor vitae purus faucibus ornare. Lectus sit amet est placerat in egestas erat imperdiet sed. Aliquam sem et tortor consequat id. Fermentum iaculis eu non diam phasellus vestibulum. Ultricies integer quis auctor elit sed. Fermentum odio eu feugiat pretium nibh ipsum. Ut consequat semper viverra nam libero. Blandit aliquam etiam erat velit scelerisque in dictum non consectetur. At risus viverra adipiscing at in tellus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue. At varius vel pharetra vel turpis nunc eget lorem dolor. Morbi non arcu risus quis varius. Turpis massa sed elementum tempus egestas.', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (5, 16, N'Id consectetur purus ut faucibus pulvinar elementum integer. Bibendum neque egestas congue quisque egestas diam in arcu. Eget nullam non nisi est sit amet facilisis. Sit amet consectetur adipiscing elit pellentesque. Id aliquet risus feugiat in. Enim blandit volutpat maecenas volutpat blandit aliquam etiam erat. Commodo odio aenean sed adipiscing. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Aliquet enim tortor at auctor urna nunc. Nulla pellentesque dignissim enim sit amet. Suscipit adipiscing bibendum est ultricies integer quis auctor. Lacinia quis vel eros donec ac odio tempor. Aliquam vestibulum morbi blandit cursus risus at. <br /><br /><a href="http://localhost:44357/">Go To Site1</a>', '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[HtmlText] ([HtmlTextId], [ModuleId], [Content], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (6, 17, N'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[HtmlText] OFF
|
||||
GO
|
@ -35,6 +35,19 @@ CREATE TABLE [dbo].[Tenant](
|
||||
)
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[ModuleDefinition](
|
||||
[ModuleDefinitionId] [int] IDENTITY(1,1) NOT NULL,
|
||||
[ModuleDefinitionName] [nvarchar](200) NOT NULL,
|
||||
[CreatedBy] [nvarchar](256) NOT NULL,
|
||||
[CreatedOn] [datetime] NOT NULL,
|
||||
[ModifiedBy] [nvarchar](256) NOT NULL,
|
||||
[ModifiedOn] [datetime] NOT NULL,
|
||||
CONSTRAINT [PK_ModuleDefinition] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ModuleDefinitionId] ASC
|
||||
)
|
||||
)
|
||||
GO
|
||||
|
||||
/*
|
||||
|
||||
@ -64,9 +77,5 @@ GO
|
||||
INSERT [dbo].[Alias] ([AliasId], [Name], [TenantId], [SiteId], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (1, N'{Alias}', 1, 1, '', getdate(), '', getdate())
|
||||
GO
|
||||
INSERT [dbo].[Alias] ([AliasId], [Name], [TenantId], [SiteId], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
VALUES (2, N'{Alias}/site2', 1, 2, '', getdate(), '', getdate())
|
||||
GO
|
||||
SET IDENTITY_INSERT [dbo].[Alias] OFF
|
||||
GO
|
||||
|
||||
|
@ -5,6 +5,8 @@ using System.Threading.Tasks;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Oqtane.Security
|
||||
{
|
||||
@ -31,17 +33,15 @@ namespace Oqtane.Security
|
||||
if (user != null)
|
||||
{
|
||||
id.AddClaim(new Claim(ClaimTypes.PrimarySid, user.UserId.ToString()));
|
||||
if (user.IsHost) // host users are part of every site by default
|
||||
Alias alias = Tenants.GetAlias();
|
||||
List<UserRole> userroles = UserRoles.GetUserRoles(user.UserId, alias.SiteId).ToList();
|
||||
foreach (UserRole userrole in userroles)
|
||||
{
|
||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, Constants.HostRole));
|
||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, Constants.AdminRole));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alias alias = Tenants.GetAlias();
|
||||
foreach (UserRole userrole in UserRoles.GetUserRoles(user.UserId, alias.SiteId))
|
||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, userrole.Role.Name));
|
||||
// host users are admins of every site
|
||||
if (userrole.Role.Name == Constants.HostRole && userroles.Where(item => item.Role.Name == Constants.AdminRole).FirstOrDefault() == null)
|
||||
{
|
||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, userrole.Role.Name));
|
||||
id.AddClaim(new Claim(options.ClaimsIdentity.RoleClaimType, Constants.AdminRole));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Oqtane.Infrastructure;
|
||||
|
||||
namespace Oqtane.Server
|
||||
{
|
||||
@ -144,6 +145,33 @@ namespace Oqtane.Server
|
||||
// register custom claims principal factory for role claims
|
||||
services.AddTransient<IUserClaimsPrincipalFactory<IdentityUser>, ClaimsPrincipalFactory<IdentityUser>>();
|
||||
|
||||
// register singleton scoped core services
|
||||
services.AddSingleton<IConfigurationRoot>(Configuration);
|
||||
services.AddSingleton<IInstallation, Installation>();
|
||||
|
||||
// install any modules or themes
|
||||
ServiceProvider sp = services.BuildServiceProvider();
|
||||
var Installation = sp.GetRequiredService<IInstallation>();
|
||||
Installation.Install("Modules,Themes");
|
||||
|
||||
// register transient scoped core services
|
||||
services.AddTransient<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
||||
services.AddTransient<IThemeRepository, ThemeRepository>();
|
||||
services.AddTransient<IUserPermissions, UserPermissions>();
|
||||
services.AddTransient<ITenantResolver, TenantResolver>();
|
||||
services.AddTransient<IAliasRepository, AliasRepository>();
|
||||
services.AddTransient<ITenantRepository, TenantRepository>();
|
||||
services.AddTransient<ISiteRepository, SiteRepository>();
|
||||
services.AddTransient<IPageRepository, PageRepository>();
|
||||
services.AddTransient<IModuleRepository, ModuleRepository>();
|
||||
services.AddTransient<IPageModuleRepository, PageModuleRepository>();
|
||||
services.AddTransient<IUserRepository, UserRepository>();
|
||||
services.AddTransient<IProfileRepository, ProfileRepository>();
|
||||
services.AddTransient<IRoleRepository, RoleRepository>();
|
||||
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
||||
services.AddTransient<IPermissionRepository, PermissionRepository>();
|
||||
services.AddTransient<ISettingRepository, SettingRepository>();
|
||||
|
||||
// get list of loaded assemblies
|
||||
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
@ -177,28 +205,6 @@ namespace Oqtane.Server
|
||||
|
||||
services.AddMvc().AddModuleAssemblies(moduleassemblies).AddNewtonsoftJson();
|
||||
|
||||
// register singleton scoped core services
|
||||
services.AddSingleton<IConfigurationRoot>(Configuration);
|
||||
services.AddSingleton<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
||||
services.AddSingleton<IThemeRepository, ThemeRepository>();
|
||||
|
||||
// register transient scoped core services
|
||||
services.AddTransient<IUserPermissions, UserPermissions>();
|
||||
services.AddTransient<ITenantResolver, TenantResolver>();
|
||||
services.AddTransient<IAliasRepository, AliasRepository>();
|
||||
services.AddTransient<ITenantRepository, TenantRepository>();
|
||||
services.AddTransient<ISiteRepository, SiteRepository>();
|
||||
services.AddTransient<IPageRepository, PageRepository>();
|
||||
services.AddTransient<IModuleRepository, ModuleRepository>();
|
||||
services.AddTransient<IPageModuleRepository, PageModuleRepository>();
|
||||
services.AddTransient<IUserRepository, UserRepository>();
|
||||
services.AddTransient<IProfileRepository, ProfileRepository>();
|
||||
services.AddTransient<ISiteUserRepository, SiteUserRepository>();
|
||||
services.AddTransient<IRoleRepository, RoleRepository>();
|
||||
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
||||
services.AddTransient<IPermissionRepository, PermissionRepository>();
|
||||
services.AddTransient<ISettingRepository, SettingRepository>();
|
||||
|
||||
// dynamically register module services, contexts, and repository classes
|
||||
assemblies = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.Where(item => item.FullName.StartsWith("Oqtane.") || item.FullName.Contains(".Module.")).ToArray();
|
||||
@ -358,10 +364,10 @@ namespace Oqtane.Server
|
||||
|
||||
// register singleton scoped core services
|
||||
services.AddSingleton<IConfigurationRoot>(Configuration);
|
||||
services.AddSingleton<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
||||
services.AddSingleton<IThemeRepository, ThemeRepository>();
|
||||
|
||||
// register transient scoped core services
|
||||
services.AddTransient<IModuleDefinitionRepository, ModuleDefinitionRepository>();
|
||||
services.AddTransient<IThemeRepository, ThemeRepository>();
|
||||
services.AddTransient<IUserPermissions, UserPermissions>();
|
||||
services.AddTransient<ITenantResolver, TenantResolver>();
|
||||
services.AddTransient<IAliasRepository, AliasRepository>();
|
||||
@ -371,7 +377,6 @@ namespace Oqtane.Server
|
||||
services.AddTransient<IModuleRepository, ModuleRepository>();
|
||||
services.AddTransient<IPageModuleRepository, PageModuleRepository>();
|
||||
services.AddTransient<IUserRepository, UserRepository>();
|
||||
services.AddTransient<ISiteUserRepository, SiteUserRepository>();
|
||||
services.AddTransient<IRoleRepository, RoleRepository>();
|
||||
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
||||
services.AddTransient<IPermissionRepository, PermissionRepository>();
|
||||
|
Reference in New Issue
Block a user