Merge pull request #67 from sbwalker/master
optimize for IEnumerable and remove unnecessary exception handling in repository
This commit is contained in:
commit
c7060521c9
|
@ -19,8 +19,6 @@ namespace Oqtane.Repository
|
|||
}
|
||||
|
||||
public IEnumerable<Alias> GetAliases()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _cache.GetOrCreate("aliases", entry =>
|
||||
{
|
||||
|
@ -28,64 +26,31 @@ namespace Oqtane.Repository
|
|||
return db.Alias.ToList();
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Alias AddAlias(Alias Alias)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Alias.Add(Alias);
|
||||
db.SaveChanges();
|
||||
return Alias;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Alias UpdateAlias(Alias Alias)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Alias).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return Alias;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Alias GetAlias(int AliasId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Alias.Find(AliasId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAlias(int AliasId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Alias alias = db.Alias.Find(AliasId);
|
||||
db.Alias.Remove(alias);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Oqtane.Repository
|
|||
void UpdatePermissions(int SiteId, string EntityName, int EntityId, string Permissions);
|
||||
Permission GetPermission(int PermissionId);
|
||||
void DeletePermission(int PermissionId);
|
||||
string EncodePermissions(int EntityId, List<Permission> Permissions);
|
||||
List<Permission> DecodePermissions(string Permissions, int SiteId, string EntityName, int EntityId);
|
||||
string EncodePermissions(int EntityId, IEnumerable<Permission> Permissions);
|
||||
IEnumerable<Permission> DecodePermissions(string Permissions, int SiteId, string EntityName, int EntityId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,70 +18,39 @@ namespace Oqtane.Repository
|
|||
|
||||
public IEnumerable<Module> GetModules()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Module.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.Module;
|
||||
}
|
||||
|
||||
public IEnumerable<Module> GetModules(int SiteId, string ModuleDefinitionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Permission> permissions = Permissions.GetPermissions(SiteId, "Module").ToList();
|
||||
List<Module> modules = db.Module
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Module").ToList();
|
||||
IEnumerable<Module> modules = db.Module
|
||||
.Where(item => item.SiteId == SiteId)
|
||||
.Where(item => item.ModuleDefinitionName == ModuleDefinitionName)
|
||||
.ToList();
|
||||
.Where(item => item.ModuleDefinitionName == ModuleDefinitionName);
|
||||
foreach (Module module in modules)
|
||||
{
|
||||
module.Permissions = Permissions.EncodePermissions(module.ModuleId, permissions);
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Module AddModule(Module Module)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Module.Add(Module);
|
||||
db.SaveChanges();
|
||||
Permissions.UpdatePermissions(Module.SiteId, "Module", Module.ModuleId, Module.Permissions);
|
||||
return Module;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Module UpdateModule(Module Module)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Module).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
Permissions.UpdatePermissions(Module.SiteId, "Module", Module.ModuleId, Module.Permissions);
|
||||
return Module;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Module GetModule(int ModuleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Module module = db.Module.Find(ModuleId);
|
||||
if (module != null)
|
||||
|
@ -91,25 +60,13 @@ namespace Oqtane.Repository
|
|||
}
|
||||
return module;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteModule(int ModuleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Module Module = db.Module.Find(ModuleId);
|
||||
Permissions.UpdatePermissions(Module.SiteId, "Module", ModuleId, "");
|
||||
db.Module.Remove(Module);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,25 +18,15 @@ namespace Oqtane.Repository
|
|||
|
||||
public IEnumerable<PageModule> GetPageModules()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.PageModule.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.PageModule;
|
||||
}
|
||||
public IEnumerable<PageModule> GetPageModules(int PageId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<PageModule> pagemodules = db.PageModule.Where(item => item.PageId == PageId)
|
||||
.Include(item => item.Module) // eager load modules
|
||||
.ToList();
|
||||
IEnumerable<PageModule> pagemodules = db.PageModule.Where(item => item.PageId == PageId)
|
||||
.Include(item => item.Module); // eager load modules
|
||||
if (pagemodules != null && pagemodules.Any())
|
||||
{
|
||||
List<Permission> permissions = Permissions.GetPermissions(pagemodules.FirstOrDefault().Module.SiteId, "Module").ToList();
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(pagemodules.FirstOrDefault().Module.SiteId, "Module").ToList();
|
||||
foreach (PageModule pagemodule in pagemodules)
|
||||
{
|
||||
pagemodule.Module.Permissions = Permissions.EncodePermissions(pagemodule.ModuleId, permissions);
|
||||
|
@ -44,71 +34,38 @@ namespace Oqtane.Repository
|
|||
}
|
||||
return pagemodules;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public PageModule AddPageModule(PageModule PageModule)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.PageModule.Add(PageModule);
|
||||
db.SaveChanges();
|
||||
return PageModule;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public PageModule UpdatePageModule(PageModule PageModule)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(PageModule).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return PageModule;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public PageModule GetPageModule(int PageModuleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
PageModule pagemodule = db.PageModule.Include(item => item.Module) // eager load modules
|
||||
.SingleOrDefault(item => item.PageModuleId == PageModuleId);
|
||||
if (pagemodule != null)
|
||||
{
|
||||
List<Permission> permissions = Permissions.GetPermissions("Module", pagemodule.ModuleId).ToList();
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions("Module", pagemodule.ModuleId);
|
||||
pagemodule.Module.Permissions = Permissions.EncodePermissions(pagemodule.ModuleId, permissions);
|
||||
}
|
||||
return pagemodule;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeletePageModule(int PageModuleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
PageModule PageModule = db.PageModule.Find(PageModuleId);
|
||||
db.PageModule.Remove(PageModule);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,96 +17,54 @@ namespace Oqtane.Repository
|
|||
}
|
||||
|
||||
public IEnumerable<Page> GetPages()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Page.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Page> GetPages(int SiteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Permission> permissions = Permissions.GetPermissions(SiteId, "Page").ToList();
|
||||
List<Page> pages = db.Page.Where(item => item.SiteId == SiteId).ToList();
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Page").ToList();
|
||||
IEnumerable<Page> pages = db.Page.Where(item => item.SiteId == SiteId);
|
||||
foreach(Page page in pages)
|
||||
{
|
||||
page.Permissions = Permissions.EncodePermissions(page.PageId, permissions);
|
||||
}
|
||||
return pages;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Page AddPage(Page Page)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Page.Add(Page);
|
||||
db.SaveChanges();
|
||||
Permissions.UpdatePermissions(Page.SiteId, "Page", Page.PageId, Page.Permissions);
|
||||
return Page;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Page UpdatePage(Page Page)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Page).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
Permissions.UpdatePermissions(Page.SiteId, "Page", Page.PageId, Page.Permissions);
|
||||
return Page;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Page GetPage(int PageId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Page page = db.Page.Find(PageId);
|
||||
if (page != null)
|
||||
{
|
||||
List<Permission> permissions = Permissions.GetPermissions("Page", page.PageId).ToList();
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions("Page", page.PageId);
|
||||
page.Permissions = Permissions.EncodePermissions(page.PageId, permissions);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeletePage(int PageId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Page Page = db.Page.Find(PageId);
|
||||
Permissions.UpdatePermissions(Page.SiteId, "Page", PageId, "");
|
||||
db.Page.Remove(Page);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,81 +21,47 @@ namespace Oqtane.Repository
|
|||
}
|
||||
|
||||
public IEnumerable<Permission> GetPermissions(int SiteId, string EntityName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Permission.Where(item => item.SiteId == SiteId)
|
||||
.Where(item => item.EntityName == EntityName)
|
||||
.Include(item => item.Role); // eager load roles
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Permission> GetPermissions(string EntityName, int EntityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Permission.Where(item => item.EntityName == EntityName)
|
||||
.Where(item => item.EntityId == EntityId)
|
||||
.Include(item => item.Role); // eager load roles
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Permission> GetPermissions(string EntityName, int EntityId, string PermissionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Permission.Where(item => item.EntityName == EntityName)
|
||||
.Where(item => item.EntityId == EntityId)
|
||||
.Where(item => item.PermissionName == PermissionName)
|
||||
.Include(item => item.Role); // eager load roles
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Permission AddPermission(Permission Permission)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Permission.Add(Permission);
|
||||
db.SaveChanges();
|
||||
return Permission;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Permission UpdatePermission(Permission Permission)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Permission).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return Permission;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePermissions(int SiteId, string EntityName, int EntityId, string Permissions)
|
||||
{
|
||||
// get current permissions and delete
|
||||
List<Permission> permissions = db.Permission.Where(item => item.EntityName == EntityName)
|
||||
.Where(item => item.EntityId == EntityId).ToList();
|
||||
IEnumerable<Permission> permissions = db.Permission
|
||||
.Where(item => item.EntityName == EntityName)
|
||||
.Where(item => item.EntityId == EntityId);
|
||||
foreach(Permission permission in permissions)
|
||||
{
|
||||
db.Permission.Remove(permission);
|
||||
|
@ -110,33 +76,19 @@ namespace Oqtane.Repository
|
|||
}
|
||||
|
||||
public Permission GetPermission(int PermissionId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Permission.Find(PermissionId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeletePermission(int PermissionId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Permission Permission = db.Permission.Find(PermissionId);
|
||||
db.Permission.Remove(Permission);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// permissions are stored in the format "{permissionname:!rolename1;![userid1];rolename2;rolename3;[userid2];[userid3]}" where "!" designates Deny permissions
|
||||
public string EncodePermissions(int EntityId, List<Permission> Permissions)
|
||||
public string EncodePermissions(int EntityId, IEnumerable<Permission> Permissions)
|
||||
{
|
||||
List<PermissionString> permissionstrings = new List<PermissionString>();
|
||||
string permissionname = "";
|
||||
|
@ -189,7 +141,7 @@ namespace Oqtane.Repository
|
|||
return JsonSerializer.Serialize(permissionstrings);
|
||||
}
|
||||
|
||||
public List<Permission> DecodePermissions(string PermissionStrings, int SiteId, string EntityName, int EntityId)
|
||||
public IEnumerable<Permission> DecodePermissions(string PermissionStrings, int SiteId, string EntityName, int EntityId)
|
||||
{
|
||||
List<Permission> permissions = new List<Permission>();
|
||||
List<Role> roles = Roles.GetRoles(SiteId, true).ToList();
|
||||
|
|
|
@ -16,93 +16,44 @@ namespace Oqtane.Repository
|
|||
|
||||
public IEnumerable<Role> GetRoles()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Role.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.Role;
|
||||
}
|
||||
|
||||
public IEnumerable<Role> GetRoles(int SiteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Role.Where(item => item.SiteId == SiteId).ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.Role.Where(item => item.SiteId == SiteId);
|
||||
}
|
||||
|
||||
public IEnumerable<Role> GetRoles(int SiteId, bool IncludeGlobalRoles)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Role.Where(item => item.SiteId == SiteId || item.SiteId == null).ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.Role.Where(item => item.SiteId == SiteId || item.SiteId == null);
|
||||
}
|
||||
|
||||
|
||||
public Role AddRole(Role Role)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Role.Add(Role);
|
||||
db.SaveChanges();
|
||||
return Role;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Role UpdateRole(Role Role)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Role).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return Role;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Role GetRole(int RoleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Role.Find(RoleId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteRole(int RoleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Role Role = db.Role.Find(RoleId);
|
||||
db.Role.Remove(Role);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,70 +15,35 @@ namespace Oqtane.Repository
|
|||
}
|
||||
|
||||
public IEnumerable<Setting> GetSettings(string EntityName, int EntityId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Setting.Where(item => item.EntityName == EntityName)
|
||||
.Where(item => item.EntityId == EntityId).ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
.Where(item => item.EntityId == EntityId);
|
||||
}
|
||||
|
||||
public Setting AddSetting(Setting Setting)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Setting.Add(Setting);
|
||||
db.SaveChanges();
|
||||
return Setting;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Setting UpdateSetting(Setting Setting)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Setting).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return Setting;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Setting GetSetting(int SettingId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Setting.Find(SettingId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteSetting(int SettingId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Setting Setting = db.Setting.Find(SettingId);
|
||||
db.Setting.Remove(Setting);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,68 +16,33 @@ namespace Oqtane.Repository
|
|||
|
||||
public IEnumerable<Site> GetSites()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Site.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.Site;
|
||||
}
|
||||
|
||||
public Site AddSite(Site Site)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Site.Add(Site);
|
||||
db.SaveChanges();
|
||||
return Site;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Site UpdateSite(Site Site)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Site).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return Site;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Site GetSite(int siteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Site.Find(siteId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteSite(int siteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Site site = db.Site.Find(siteId);
|
||||
db.Site.Remove(site);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,94 +16,45 @@ namespace Oqtane.Repository
|
|||
|
||||
public IEnumerable<SiteUser> GetSiteUsers()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.SiteUser.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.SiteUser;
|
||||
}
|
||||
public IEnumerable<SiteUser> GetSiteUsers(int SiteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.SiteUser.Where(item => item.SiteId == SiteId)
|
||||
.Include(item => item.User) // eager load users
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
.Include(item => item.User); // eager load users
|
||||
}
|
||||
|
||||
public SiteUser AddSiteUser(SiteUser SiteUser)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.SiteUser.Add(SiteUser);
|
||||
db.SaveChanges();
|
||||
return SiteUser;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public SiteUser UpdateSiteUser(SiteUser SiteUser)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(SiteUser).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return SiteUser;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public SiteUser GetSiteUser(int SiteUserId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.SiteUser.Include(item => item.User) // eager load users
|
||||
.SingleOrDefault(item => item.SiteUserId == SiteUserId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public SiteUser GetSiteUser(int SiteId, int UserId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.SiteUser.Where(item => item.SiteId == SiteId).Where(item => item.UserId == UserId).FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.SiteUser.Where(item => item.SiteId == SiteId)
|
||||
.Where(item => item.UserId == UserId).FirstOrDefault();
|
||||
}
|
||||
|
||||
public void DeleteSiteUser(int SiteUserId)
|
||||
{
|
||||
try
|
||||
{
|
||||
SiteUser SiteUser = db.SiteUser.Find(SiteUserId);
|
||||
db.SiteUser.Remove(SiteUser);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ namespace Oqtane.Repository
|
|||
}
|
||||
|
||||
public IEnumerable<Tenant> GetTenants()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _cache.GetOrCreate("tenants", entry =>
|
||||
{
|
||||
|
@ -29,64 +27,31 @@ namespace Oqtane.Repository
|
|||
return db.Tenant.ToList();
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Tenant AddTenant(Tenant Tenant)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Tenant.Add(Tenant);
|
||||
db.SaveChanges();
|
||||
return Tenant;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Tenant UpdateTenant(Tenant Tenant)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(Tenant).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return Tenant;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Tenant GetTenant(int TenantId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.Tenant.Find(TenantId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteTenant(int TenantId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Tenant tenant = db.Tenant.Find(TenantId);
|
||||
db.Tenant.Remove(tenant);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,29 +34,15 @@ namespace Oqtane.Repository
|
|||
}
|
||||
|
||||
public Alias GetAlias()
|
||||
{
|
||||
try
|
||||
{
|
||||
IEnumerable<Alias> aliases = _aliasrepository.GetAliases(); // cached
|
||||
return aliases.Where(item => item.Name == aliasname).FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public Tenant GetTenant()
|
||||
{
|
||||
try
|
||||
{
|
||||
IEnumerable<Tenant> tenants = _tenantrepository.GetTenants(); // cached
|
||||
return tenants.Where(item => item.TenantId == GetAlias().TenantId).FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,80 +16,38 @@ namespace Oqtane.Repository
|
|||
|
||||
public IEnumerable<User> GetUsers()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.User.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.User;
|
||||
}
|
||||
|
||||
public User AddUser(User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.User.Add(user);
|
||||
db.SaveChanges();
|
||||
return user;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public User UpdateUser(User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(user).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return user;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public User GetUser(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.User.Find(userId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public User GetUser(string Username)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.User.Where(item => item.Username == Username).FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteUser(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
User user = db.User.Find(userId);
|
||||
db.User.Remove(user);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,97 +16,46 @@ namespace Oqtane.Repository
|
|||
|
||||
public IEnumerable<UserRole> GetUserRoles()
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.UserRole.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return db.UserRole;
|
||||
}
|
||||
public IEnumerable<UserRole> GetUserRoles(int UserId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.UserRole.Where(item => item.UserId == UserId)
|
||||
.Include(item => item.Role) // eager load roles
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
.Include(item => item.Role); // eager load roles
|
||||
}
|
||||
|
||||
public IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.UserRole.Where(item => item.UserId == UserId)
|
||||
.Include(item => item.Role) // eager load roles
|
||||
.Where(item => item.Role.SiteId == SiteId)
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
.Where(item => item.Role.SiteId == SiteId);
|
||||
}
|
||||
|
||||
public UserRole AddUserRole(UserRole UserRole)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.UserRole.Add(UserRole);
|
||||
db.SaveChanges();
|
||||
return UserRole;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public UserRole UpdateUserRole(UserRole UserRole)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(UserRole).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return UserRole;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public UserRole GetUserRole(int UserRoleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return db.UserRole.Include(item => item.Role) // eager load roles
|
||||
.SingleOrDefault(item => item.UserRoleId == UserRoleId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteUserRole(int UserRoleId)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserRole UserRole = db.UserRole.Find(UserRoleId);
|
||||
db.UserRole.Remove(UserRole);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,6 +232,38 @@ REFERENCES [dbo].[Module] ([ModuleId])
|
|||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.Role ADD CONSTRAINT FK_Role_Site FOREIGN KEY (SiteId)
|
||||
REFERENCES dbo.Site (SiteId)
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.UserRole ADD CONSTRAINT FK_UserRole_User FOREIGN KEY (UserId)
|
||||
REFERENCES dbo.[User] (UserId)
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.UserRole ADD CONSTRAINT FK_UserRole_Role FOREIGN KEY (RoleId)
|
||||
REFERENCES dbo.Role (RoleId)
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.Permission ADD CONSTRAINT FK_Permission_Site FOREIGN KEY (SiteId)
|
||||
REFERENCES dbo.Site (SiteId)
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.Permission ADD CONSTRAINT FK_Permission_User FOREIGN KEY (UserId)
|
||||
REFERENCES dbo.[User] (UserId)
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.Permission ADD CONSTRAINT FK_Permission_Role FOREIGN KEY (RoleId)
|
||||
REFERENCES dbo.Role (RoleId)
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.PageModule ADD CONSTRAINT FK_PageModule_Page FOREIGN KEY (PageId)
|
||||
REFERENCES dbo.Page (PageId)
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
/*
|
||||
|
||||
Create indexes
|
||||
|
@ -246,6 +278,44 @@ CREATE UNIQUE NONCLUSTERED INDEX IX_Setting ON dbo.Setting
|
|||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE UNIQUE NONCLUSTERED INDEX IX_User ON dbo.[User]
|
||||
(
|
||||
Username
|
||||
) 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,
|
||||
EntityName,
|
||||
EntityId,
|
||||
PermissionName,
|
||||
RoleId,
|
||||
UserId
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE UNIQUE NONCLUSTERED INDEX IX_Page ON dbo.Page
|
||||
(
|
||||
SiteId,
|
||||
[Path]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE UNIQUE NONCLUSTERED INDEX IX_UserRole ON dbo.UserRole
|
||||
(
|
||||
RoleId,
|
||||
UserId
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
/*
|
||||
|
||||
Create seed data
|
||||
|
@ -293,6 +363,8 @@ VALUES (1, 1, N'Page1', N'', N'Oqtane.Client.Themes.Theme1.Theme1, Oqtane.Client
|
|||
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], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -307,6 +379,8 @@ VALUES (3, 1, N'Page3', N'page3', N'Oqtane.Client.Themes.Theme3.Theme3, Oqtane.C
|
|||
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], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -328,6 +402,8 @@ VALUES (6, 1, N'Login', N'login', N'Oqtane.Client.Themes.Theme2.Theme2, Oqtane.C
|
|||
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], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -335,6 +411,8 @@ VALUES (7, 1, N'Register', N'register', N'Oqtane.Client.Themes.Theme2.Theme2, Oq
|
|||
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], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -370,6 +448,8 @@ VALUES (12, 2, N'Page1', N'', N'Oqtane.Client.Themes.Theme2.Theme2, Oqtane.Clien
|
|||
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], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -377,6 +457,8 @@ VALUES (13, 2, N'Page2', N'page2', N'Oqtane.Client.Themes.Theme2.Theme2, Oqtane.
|
|||
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], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -384,6 +466,8 @@ VALUES (14, 2, N'Login', N'login', N'Oqtane.Client.Themes.Theme2.Theme2, Oqtane.
|
|||
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], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -391,6 +475,8 @@ VALUES (15, 2, N'Register', N'register', N'Oqtane.Client.Themes.Theme2.Theme2, O
|
|||
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
|
||||
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
|
||||
|
@ -410,6 +496,8 @@ VALUES (1, 1, N'Oqtane.Client.Modules.Weather, Oqtane.Client', '', 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])
|
||||
|
@ -417,6 +505,8 @@ VALUES (2, 1, N'Oqtane.Client.Modules.Counter, Oqtane.Client', '', 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])
|
||||
|
@ -424,6 +514,8 @@ VALUES (3, 1, N'Oqtane.Client.Modules.HtmlText, Oqtane.Client', '', 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])
|
||||
|
@ -431,6 +523,8 @@ VALUES (4, 1, N'Oqtane.Client.Modules.Weather, Oqtane.Client', '', 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])
|
||||
|
@ -438,6 +532,8 @@ VALUES (5, 1, N'Oqtane.Client.Modules.HtmlText, Oqtane.Client', '', 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])
|
||||
|
@ -445,6 +541,8 @@ VALUES (6, 1, N'Oqtane.Client.Modules.HtmlText, Oqtane.Client', '', 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])
|
||||
|
@ -466,6 +564,8 @@ VALUES (9, 1, N'Oqtane.Client.Modules.Admin.Login, Oqtane.Client', '', 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])
|
||||
|
@ -473,6 +573,8 @@ VALUES (10, 1, N'Oqtane.Client.Modules.Admin.Register, Oqtane.Client', '', getda
|
|||
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])
|
||||
|
@ -515,6 +617,8 @@ VALUES (16, 2, N'Oqtane.Client.Modules.HtmlText, Oqtane.Client', '', 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])
|
||||
|
@ -522,6 +626,8 @@ VALUES (17, 2, N'Oqtane.Client.Modules.HtmlText, Oqtane.Client', '', 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])
|
||||
|
@ -529,6 +635,8 @@ VALUES (18, 2, N'Oqtane.Client.Modules.Admin.Login, Oqtane.Client', '', 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])
|
||||
|
@ -536,6 +644,8 @@ VALUES (19, 2, N'Oqtane.Client.Modules.Admin.Register, Oqtane.Client', '', getda
|
|||
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])
|
||||
|
|
Loading…
Reference in New Issue
Block a user