EntityNames replacements
This commit is contained in:
parent
d7b95f5b2c
commit
7feee22b32
|
@ -100,12 +100,12 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parentid = folders[0].FolderId;
|
_parentId = _folders[0].FolderId;
|
||||||
List<PermissionString> permissionstrings = new List<PermissionString>();
|
List<PermissionString> permissionstrings = new List<PermissionString>();
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Browse, Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Browse, Permissions = Constants.AdminRole });
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = Constants.AdminRole });
|
||||||
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Edit, Permissions = Constants.AdminRole });
|
permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Edit, Permissions = Constants.AdminRole });
|
||||||
permissions = UserSecurity.SetPermissionStrings(permissionstrings);
|
_permissions = UserSecurity.SetPermissionStrings(permissionstrings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<label class="control-label">Permissions: </label>
|
<label class="control-label">Permissions: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<PermissionGrid EntityName="ModuleDefinition" PermissionNames=PermissionNames.Utilize Permissions="@permissions" @ref="permissiongrid" />
|
<PermissionGrid EntityName="ModuleDefinition" PermissionNames=PermissionNames.Utilize Permissions="@_permissions" @ref="_permissionGrid" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -120,7 +120,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Models.File Put(int id, [FromBody] Models.File File)
|
public Models.File Put(int id, [FromBody] Models.File File)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Folder", File.Folder.FolderId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, File.Folder.FolderId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
File = _files.UpdateFile(File);
|
File = _files.UpdateFile(File);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "File Updated {File}", File);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "File Updated {File}", File);
|
||||||
|
@ -140,7 +140,7 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Models.File file = _files.GetFile(id);
|
Models.File file = _files.GetFile(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "Folder", file.Folder.FolderId, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, file.Folder.FolderId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_files.DeleteFile(id);
|
_files.DeleteFile(id);
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Folder Put(int id, [FromBody] Folder Folder)
|
public Folder Put(int id, [FromBody] Folder Folder)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Folder", Folder.FolderId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, Folder.FolderId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Folder.Path) && Folder.ParentId != null)
|
if (string.IsNullOrEmpty(Folder.Path) && Folder.ParentId != null)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Put(int siteid, int folderid, int? parentid)
|
public void Put(int siteid, int folderid, int? parentid)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Folder", folderid, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, folderid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
int order = 1;
|
int order = 1;
|
||||||
List<Folder> folders = _folders.GetFolders(siteid).ToList();
|
List<Folder> folders = _folders.GetFolders(siteid).ToList();
|
||||||
|
@ -175,7 +175,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Folder", id, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, id, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_folders.DeleteFolder(id);
|
_folders.DeleteFolder(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Folder Deleted {FolderId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Folder Deleted {FolderId}", id);
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Models.Module Post([FromBody] Models.Module Module)
|
public Models.Module Post([FromBody] Models.Module Module)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Page", Module.PageId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, Module.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Module = _modules.AddModule(Module);
|
Module = _modules.AddModule(Module);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Added {Module}", Module);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Module Added {Module}", Module);
|
||||||
|
@ -108,7 +108,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Models.Module Put(int id, [FromBody] Models.Module Module)
|
public Models.Module Put(int id, [FromBody] Models.Module Module)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Module", Module.ModuleId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, Module.ModuleId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Module = _modules.UpdateModule(Module);
|
Module = _modules.UpdateModule(Module);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", Module);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", Module);
|
||||||
|
@ -127,7 +127,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Module", id, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Module, id, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_modules.DeleteModule(id);
|
_modules.DeleteModule(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Deleted {ModuleId}", id);
|
||||||
|
@ -145,7 +145,7 @@ namespace Oqtane.Controllers
|
||||||
public string Export(int moduleid)
|
public string Export(int moduleid)
|
||||||
{
|
{
|
||||||
string content = "";
|
string content = "";
|
||||||
if (_userPermissions.IsAuthorized(User, "Module", moduleid, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Module, moduleid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
content = _modules.ExportModule(moduleid);
|
content = _modules.ExportModule(moduleid);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ namespace Oqtane.Controllers
|
||||||
public bool Import(int moduleid, [FromBody] string Content)
|
public bool Import(int moduleid, [FromBody] string Content)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Module", moduleid, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, moduleid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
success = _modules.ImportModule(moduleid, Content);
|
success = _modules.ImportModule(moduleid, Content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace Oqtane.Controllers
|
||||||
if (_userPermissions.IsAuthorized(User,PermissionNames.Edit, permissions))
|
if (_userPermissions.IsAuthorized(User,PermissionNames.Edit, permissions))
|
||||||
{
|
{
|
||||||
Page = _pages.AddPage(Page);
|
Page = _pages.AddPage(Page);
|
||||||
_syncManager.AddSyncEvent("Site", Page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, Page.SiteId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Added {Page}", Page);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Added {Page}", Page);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -156,7 +156,7 @@ namespace Oqtane.Controllers
|
||||||
page.IsPersonalizable = false;
|
page.IsPersonalizable = false;
|
||||||
page.UserId = int.Parse(userid);
|
page.UserId = int.Parse(userid);
|
||||||
page = _pages.AddPage(page);
|
page = _pages.AddPage(page);
|
||||||
_syncManager.AddSyncEvent("Site", page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, page.SiteId);
|
||||||
|
|
||||||
// copy modules
|
// copy modules
|
||||||
List<PageModule> pagemodules = _pageModules.GetPageModules(page.SiteId).ToList();
|
List<PageModule> pagemodules = _pageModules.GetPageModules(page.SiteId).ToList();
|
||||||
|
@ -197,10 +197,10 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Page Put(int id, [FromBody] Page Page)
|
public Page Put(int id, [FromBody] Page Page)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Page", Page.PageId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, Page.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
Page = _pages.UpdatePage(Page);
|
Page = _pages.UpdatePage(Page);
|
||||||
_syncManager.AddSyncEvent("Site", Page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, Page.SiteId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Updated {Page}", Page);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Updated {Page}", Page);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -217,7 +217,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Put(int siteid, int pageid, int? parentid)
|
public void Put(int siteid, int pageid, int? parentid)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", pageid, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
int order = 1;
|
int order = 1;
|
||||||
List<Page> pages = _pages.GetPages(siteid).ToList();
|
List<Page> pages = _pages.GetPages(siteid).ToList();
|
||||||
|
@ -230,7 +230,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
order += 2;
|
order += 2;
|
||||||
}
|
}
|
||||||
_syncManager.AddSyncEvent("Site", siteid);
|
_syncManager.AddSyncEvent(EntityNames.Site, siteid);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Order Updated {SiteId} {PageId} {ParentId}", siteid, pageid, parentid);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Order Updated {SiteId} {PageId} {ParentId}", siteid, pageid, parentid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -246,10 +246,10 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
Page page = _pages.GetPage(id);
|
Page page = _pages.GetPage(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", page.PageId, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, page.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_pages.DeletePage(page.PageId);
|
_pages.DeletePage(page.PageId);
|
||||||
_syncManager.AddSyncEvent("Site", page.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, page.SiteId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Deleted {PageId}", page.PageId);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Deleted {PageId}", page.PageId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -67,10 +67,10 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public PageModule Post([FromBody] PageModule PageModule)
|
public PageModule Post([FromBody] PageModule PageModule)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Page", PageModule.PageId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Page, PageModule.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
PageModule = _pageModules.AddPageModule(PageModule);
|
PageModule = _pageModules.AddPageModule(PageModule);
|
||||||
_syncManager.AddSyncEvent("Page", PageModule.PageId);
|
_syncManager.AddSyncEvent(EntityNames.Page, PageModule.PageId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Module Added {PageModule}", PageModule);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Page Module Added {PageModule}", PageModule);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -87,10 +87,10 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public PageModule Put(int id, [FromBody] PageModule PageModule)
|
public PageModule Put(int id, [FromBody] PageModule PageModule)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, "Module", PageModule.ModuleId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, PageModule.ModuleId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
PageModule = _pageModules.UpdatePageModule(PageModule);
|
PageModule = _pageModules.UpdatePageModule(PageModule);
|
||||||
_syncManager.AddSyncEvent("Page", PageModule.PageId);
|
_syncManager.AddSyncEvent(EntityNames.Page, PageModule.PageId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Updated {PageModule}", PageModule);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Updated {PageModule}", PageModule);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -107,7 +107,7 @@ namespace Oqtane.Controllers
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public void Put(int pageid, string pane)
|
public void Put(int pageid, string pane)
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", pageid, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pageid, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
int order = 1;
|
int order = 1;
|
||||||
List<PageModule> pagemodules = _pageModules.GetPageModules(pageid, pane).OrderBy(item => item.Order).ToList();
|
List<PageModule> pagemodules = _pageModules.GetPageModules(pageid, pane).OrderBy(item => item.Order).ToList();
|
||||||
|
@ -120,7 +120,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
order += 2;
|
order += 2;
|
||||||
}
|
}
|
||||||
_syncManager.AddSyncEvent("Page", pageid);
|
_syncManager.AddSyncEvent(EntityNames.Page, pageid);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Order Updated {PageId} {Pane}", pageid, pane);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Page Module Order Updated {PageId} {Pane}", pageid, pane);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -136,10 +136,10 @@ namespace Oqtane.Controllers
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
PageModule pagemodule = _pageModules.GetPageModule(id);
|
PageModule pagemodule = _pageModules.GetPageModule(id);
|
||||||
if (_userPermissions.IsAuthorized(User, "Page", pagemodule.PageId, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Page, pagemodule.PageId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
_pageModules.DeletePageModule(id);
|
_pageModules.DeletePageModule(id);
|
||||||
_syncManager.AddSyncEvent("Page", pagemodule.PageId);
|
_syncManager.AddSyncEvent(EntityNames.Page, pagemodule.PageId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Module Deleted {PageModuleId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Page Module Deleted {PageModuleId}", id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -116,25 +116,25 @@ namespace Oqtane.Controllers
|
||||||
private bool IsAuthorized(string EntityName, int EntityId, string PermissionName)
|
private bool IsAuthorized(string EntityName, int EntityId, string PermissionName)
|
||||||
{
|
{
|
||||||
bool authorized = false;
|
bool authorized = false;
|
||||||
if (EntityName == "PageModule")
|
if (EntityName == EntityNames.PageModule)
|
||||||
{
|
{
|
||||||
EntityName = "Module";
|
EntityName = EntityNames.Module;
|
||||||
EntityId = _pageModules.GetPageModule(EntityId).ModuleId;
|
EntityId = _pageModules.GetPageModule(EntityId).ModuleId;
|
||||||
}
|
}
|
||||||
switch (EntityName)
|
switch (EntityName)
|
||||||
{
|
{
|
||||||
case "Host":
|
case EntityNames.Host:
|
||||||
authorized = User.IsInRole(Constants.HostRole);
|
authorized = User.IsInRole(Constants.HostRole);
|
||||||
break;
|
break;
|
||||||
case "Site":
|
case EntityNames.Site:
|
||||||
authorized = User.IsInRole(Constants.AdminRole);
|
authorized = User.IsInRole(Constants.AdminRole);
|
||||||
break;
|
break;
|
||||||
case "Page":
|
case EntityNames.Page:
|
||||||
case "Module":
|
case EntityNames.Module:
|
||||||
case "Folder":
|
case EntityNames.Folder:
|
||||||
authorized = _userPermissions.IsAuthorized(User, EntityName, EntityId, PermissionName);
|
authorized = _userPermissions.IsAuthorized(User, EntityName, EntityId, PermissionName);
|
||||||
break;
|
break;
|
||||||
case "User":
|
case EntityNames.User:
|
||||||
authorized = true;
|
authorized = true;
|
||||||
if (PermissionName == PermissionNames.Edit)
|
if (PermissionName == PermissionNames.Edit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace Oqtane.Controllers
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
Site = _sites.UpdateSite(Site);
|
Site = _sites.UpdateSite(Site);
|
||||||
_syncManager.AddSyncEvent("Site", Site.SiteId);
|
_syncManager.AddSyncEvent(EntityNames.Site, Site.SiteId);
|
||||||
_logger.Log(Site.SiteId, LogLevel.Information, this, LogFunction.Update, "Site Updated {Site}", Site);
|
_logger.Log(Site.SiteId, LogLevel.Information, this, LogFunction.Update, "Site Updated {Site}", Site);
|
||||||
}
|
}
|
||||||
return Site;
|
return Site;
|
||||||
|
|
|
@ -187,7 +187,7 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
User = _users.UpdateUser(User);
|
User = _users.UpdateUser(User);
|
||||||
_syncManager.AddSyncEvent("User", User.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, User.UserId);
|
||||||
User.Password = ""; // remove sensitive information
|
User.Password = ""; // remove sensitive information
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Updated {User}", User);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Updated {User}", User);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Oqtane.Controllers
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
UserRole = _userRoles.AddUserRole(UserRole);
|
UserRole = _userRoles.AddUserRole(UserRole);
|
||||||
_syncManager.AddSyncEvent("User", UserRole.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, UserRole.UserId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", UserRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "User Role Added {UserRole}", UserRole);
|
||||||
}
|
}
|
||||||
return UserRole;
|
return UserRole;
|
||||||
|
@ -60,7 +60,7 @@ namespace Oqtane.Controllers
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
UserRole = _userRoles.UpdateUserRole(UserRole);
|
UserRole = _userRoles.UpdateUserRole(UserRole);
|
||||||
_syncManager.AddSyncEvent("User", UserRole.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, UserRole.UserId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Role Updated {UserRole}", UserRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "User Role Updated {UserRole}", UserRole);
|
||||||
}
|
}
|
||||||
return UserRole;
|
return UserRole;
|
||||||
|
@ -73,7 +73,7 @@ namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
UserRole userRole = _userRoles.GetUserRole(id);
|
UserRole userRole = _userRoles.GetUserRole(id);
|
||||||
_userRoles.DeleteUserRole(id);
|
_userRoles.DeleteUserRole(id);
|
||||||
_syncManager.AddSyncEvent("User", userRole.UserId);
|
_syncManager.AddSyncEvent(EntityNames.User, userRole.UserId);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Role Deleted {UserRole}", userRole);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Role Deleted {UserRole}", userRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
Oqtane.Shared/Shared/EntityNames.cs
Normal file
13
Oqtane.Shared/Shared/EntityNames.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Oqtane.Shared
|
||||||
|
{
|
||||||
|
public class EntityNames
|
||||||
|
{
|
||||||
|
public const string Module = "Module";
|
||||||
|
public const string PageModule = "PageModule";
|
||||||
|
public const string Host = "Host";
|
||||||
|
public const string Site = "Site";
|
||||||
|
public const string Page = "Page";
|
||||||
|
public const string Folder = "Folder";
|
||||||
|
public const string User = "User";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user