protected async Task LogoutUser() { await UserService.LogoutUserAsync(PageState.User); await LoggingService.Log(PageState.Alias, PageState.Page.PageId, PageState.ModuleId, PageState.User.UserId, GetType().AssemblyQualifiedName, "Logout", LogFunction.Security, LogLevel.Information, null, "User Logout For Username {Username}", PageState.User.Username); PageState.User = null; bool authorizedtoviewpage = UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, PageState.Page.Permissions); if (PageState.Runtime == Oqtane.Shared.Runtime.Server) { // server-side Blazor needs to post to the Logout page var fields = new { __RequestVerificationToken = SiteState.AntiForgeryToken, returnurl = !authorizedtoviewpage ? PageState.Alias.Path : PageState.Alias.Path + "/" + PageState.Page.Path }; string url = Utilities.TenantUrl(PageState.Alias, "/pages/logout/"); var interop = new Interop(jsRuntime); await interop.SubmitForm(url, fields); } else { // client-side Blazor var authstateprovider = (IdentityAuthenticationStateProvider)ServiceProvider.GetService(typeof(IdentityAuthenticationStateProvider)); authstateprovider.NotifyAuthenticationChanged(); NavigationManager.NavigateTo(NavigateUrl(!authorizedtoviewpage ? PageState.Alias.Path : PageState.Page.Path, true)); } }
private async void ParentChanged(ChangeEventArgs e) { try { _parentid = (string)e.Value; _children = new List <Page>(); if (_parentid == "-1") { foreach (Page p in PageState.Pages.Where(item => item.ParentId == null)) { if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions)) { _children.Add(p); } } } else { foreach (Page p in PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid))) { if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions)) { _children.Add(p); } } } StateHasChanged(); } catch (Exception ex) { await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", _parentid, ex.Message); AddModuleMessage("Error Loading Child Pages For Parent", MessageType.Error); } }
protected async Task LogoutUser() { await UserService.LogoutUserAsync(PageState.User); PageState.User = null; bool authorizedtoviewpage = UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, PageState.Page.Permissions); if (PageState.Runtime == Oqtane.Shared.Runtime.Server) { // server-side Blazor var interop = new Interop(jsRuntime); string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken"); var fields = new { __RequestVerificationToken = antiforgerytoken, returnurl = !authorizedtoviewpage ? PageState.Alias.Path : PageState.Alias.Path + "/" + PageState.Page.Path }; string url = Utilities.TenantUrl(PageState.Alias, "/pages/logout/"); await interop.SubmitForm(url, fields); } else { // client-side Blazor var authstateprovider = (IdentityAuthenticationStateProvider)ServiceProvider.GetService(typeof(IdentityAuthenticationStateProvider)); authstateprovider.NotifyAuthenticationChanged(); NavigationManager.NavigateTo(NavigateUrl(!authorizedtoviewpage ? PageState.Alias.Path : PageState.Page.Path, "reload")); } }
private async Task GetFiles() { _haseditpermission = false; if (!string.IsNullOrEmpty(Folder)) { _haseditpermission = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole); _files = await FileService.GetFilesAsync(Folder); } else { Folder folder = _folders.FirstOrDefault(item => item.FolderId == FolderId); if (folder != null) { _haseditpermission = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, folder.Permissions); _files = await FileService.GetFilesAsync(FolderId); } else { _haseditpermission = false; _files = new List <File>(); } } if (_filter != "*") { List <File> filtered = new List <File>(); foreach (File file in _files) { if (_filter.ToUpper().IndexOf("." + file.Extension.ToUpper()) != -1) { filtered.Add(file); } } _files = filtered; } }
protected override async Task OnInitializedAsync() { Module module = await ModuleService.GetModuleAsync(ModuleState.ModuleId); if (UserSecurity.IsAuthorized(PageState.User, Constants.HostRole)) { string message = "A Problem Was Encountered Loading Module " + module.ModuleDefinitionName; AddModuleMessage(message, MessageType.Error); } await logger.LogCritical("Error Loading Module {Module}", module); }
private bool IsAuthorized() { var authorized = false; if (PageState.EditMode || !_editmode) { var security = SecurityAccessLevel.Host; if (Security == null) { var typename = ModuleState.ModuleType.Replace(Utilities.GetTypeNameLastSegment(ModuleState.ModuleType, 0) + ",", Action + ","); var moduleType = Type.GetType(typename); if (moduleType != null) { var moduleobject = Activator.CreateInstance(moduleType) as IModuleControl; security = moduleobject.SecurityAccessLevel; } else { security = SecurityAccessLevel.Anonymous; // occurs when an action does not have a corresponding module control Class = "btn btn-warning"; // alert developer of missing module comtrol } } else { security = Security.Value; } switch (security) { case SecurityAccessLevel.Anonymous: authorized = true; break; case SecurityAccessLevel.View: authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, ModuleState.Permissions); break; case SecurityAccessLevel.Edit: authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions); break; case SecurityAccessLevel.Admin: authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole); break; case SecurityAccessLevel.Host: authorized = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole); break; } } return(authorized); }
protected async Task ModuleAction(ActionViewModel action) { if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions)) { PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId); string url = NavigateUrl(true); if (action.Action != null) { url = await action.Action(url, pagemodule); } NavigationManager.NavigateTo(url); } }
private bool ValidateProfiles() { bool valid = true; foreach (Profile profile in profiles) { if (string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)) && !string.IsNullOrEmpty(profile.DefaultValue)) { settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue); } if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole)) { if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty))) { valid = false; } } } return(valid); }
private IEnumerable <Page> GetMenuPages() { var securityLevel = int.MaxValue; foreach (Page p in PageState.Pages.Where(item => item.IsNavigation && !item.IsDeleted)) { if (p.Level <= securityLevel && UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions)) { securityLevel = int.MaxValue; yield return(p); } else { if (securityLevel == int.MaxValue) { securityLevel = p.Level; } } } }
protected virtual List <ActionViewModel> GetActions() { var actionList = new List <ActionViewModel>(); if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions)) { actionList.Add(new ActionViewModel { Icon = Icons.Cog, Name = "Manage Settings", Action = async(u, m) => await Settings(u, m) }); if (UserSecurity.GetPermissionStrings(ModuleState.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(RoleNames.Everyone)) { actionList.Add(new ActionViewModel { Icon = Icons.CircleX, Name = "Unpublish Module", Action = async(s, m) => await Unpublish(s, m) }); } else { actionList.Add(new ActionViewModel { Icon = Icons.CircleCheck, Name = "Publish Module", Action = async(s, m) => await Publish(s, m) }); } actionList.Add(new ActionViewModel { Icon = Icons.Trash, Name = "Delete Module", Action = async(u, m) => await DeleteModule(u, m) }); if (ModuleState.ModuleDefinition != null && ModuleState.ModuleDefinition.ServerManagerType != "") { actionList.Add(new ActionViewModel { Name = "" }); actionList.Add(new ActionViewModel { Icon = Icons.CloudUpload, Name = "Import Content", Action = async(u, m) => await EditUrlAsync(u, m.ModuleId, "Import") }); actionList.Add(new ActionViewModel { Icon = Icons.CloudDownload, Name = "Export Content", Action = async(u, m) => await EditUrlAsync(u, m.ModuleId, "Export") }); } actionList.Add(new ActionViewModel { Name = "" }); if (ModuleState.PaneModuleIndex > 0) { actionList.Add(new ActionViewModel { Icon = Icons.DataTransferUpload, Name = "Move To Top", Action = async(s, m) => await MoveTop(s, m) }); } if (ModuleState.PaneModuleIndex > 0) { actionList.Add(new ActionViewModel { Icon = Icons.ArrowThickTop, Name = "Move Up", Action = async(s, m) => await MoveUp(s, m) }); } if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1)) { actionList.Add(new ActionViewModel { Icon = Icons.ArrowThickBottom, Name = "Move Down", Action = async(s, m) => await MoveDown(s, m) }); } if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1)) { actionList.Add(new ActionViewModel { Icon = Icons.DataTransferDownload, Name = "Move To Bottom", Action = async(s, m) => await MoveBottom(s, m) }); } foreach (string pane in PageState.Page.Panes) { if (pane != ModuleState.Pane) { actionList.Add(new ActionViewModel { Icon = Icons.AccountLogin, Name = pane + " Pane", Action = async(s, m) => await MoveToPane(s, pane, m) }); } } } return(actionList); }
#pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { #line 5 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" if (!string.IsNullOrEmpty(_message)) { #line default #line hidden __builder.AddContent(0, " "); __builder.OpenElement(1, "div"); __builder.AddAttribute(2, "class", #line 7 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" _classname #line default #line hidden ); __builder.AddAttribute(3, "role", "alert"); __builder.AddMarkupContent(4, "\n "); __builder.AddContent(5, #line 8 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" _message #line default #line hidden ); __builder.AddMarkupContent(6, "\n"); #line 9 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" if (Type == MessageType.Error && UserSecurity.IsAuthorized(PageState.User, Constants.HostRole)) { #line default #line hidden __builder.AddContent(7, #line 11 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" (MarkupString)" " #line default #line hidden ); __builder.OpenComponent <Microsoft.AspNetCore.Components.Routing.NavLink>(8); __builder.AddAttribute(9, "href", #line 11 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" NavigateUrl("admin/log") #line default #line hidden ); __builder.AddAttribute(10, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { __builder2.AddContent(11, "View Details"); } )); __builder.CloseComponent(); __builder.AddMarkupContent(12, "\n"); #line 12 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" } #line default #line hidden __builder.AddContent(13, " "); __builder.CloseElement(); __builder.AddMarkupContent(14, "\n <br>\n"); #line 15 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Controls/ModuleMessage.razor" } #line default #line hidden }
#pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __builder.OpenElement(0, "div"); __builder.AddAttribute(1, "class", "row"); __builder.AddMarkupContent(2, "\n"); #line 7 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Dashboard/Index.razor" foreach (var p in _pages) { if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions)) { string url = NavigateUrl(p.Path); #line default #line hidden __builder.AddContent(3, " "); __builder.OpenElement(4, "div"); __builder.AddAttribute(5, "class", "col-md-2 mx-auto text-center"); __builder.AddMarkupContent(6, "\n "); __builder.OpenComponent <Microsoft.AspNetCore.Components.Routing.NavLink>(7); __builder.AddAttribute(8, "class", "nav-link"); __builder.AddAttribute(9, "href", #line 13 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Dashboard/Index.razor" url #line default #line hidden ); __builder.AddAttribute(10, "Match", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck <Microsoft.AspNetCore.Components.Routing.NavLinkMatch>( #line 13 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Dashboard/Index.razor" NavLinkMatch.All #line default #line hidden )); __builder.AddAttribute(11, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { __builder2.AddMarkupContent(12, "\n "); __builder2.OpenElement(13, "h2"); __builder2.OpenElement(14, "span"); __builder2.AddAttribute(15, "class", "oi" + " oi-" + ( #line 14 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Dashboard/Index.razor" p.Icon #line default #line hidden )); __builder2.AddAttribute(16, "aria-hidden", "true"); __builder2.CloseElement(); __builder2.CloseElement(); __builder2.AddContent(17, #line 14 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Dashboard/Index.razor" p.Name #line default #line hidden ); __builder2.AddMarkupContent(18, "\n "); } )); __builder.CloseComponent(); __builder.AddMarkupContent(19, "\n "); __builder.CloseElement(); __builder.AddMarkupContent(20, "\n"); #line 17 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Dashboard/Index.razor" } } #line default #line hidden __builder.CloseElement(); }
protected override void OnParametersSet() { if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions) && Name != Constants.AdminPane) { _paneadminborder = "app-pane-admin-border"; _panetitle = "<div class=\"app-pane-admin-title\">" + Name + " Pane</div>"; } else { _paneadminborder = "container"; _panetitle = ""; } DynamicComponent = builder => { if (PageState.ModuleId != -1 && PageState.Action != Constants.DefaultAction) { if (Name.ToLower() == Constants.AdminPane.ToLower()) { Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId); if (module != null && !module.IsDeleted) { var typename = module.ModuleType; // check for core module actions component if (Constants.DefaultModuleActions.Contains(PageState.Action)) { typename = Constants.DefaultModuleActionsTemplate.Replace(Constants.ActionToken, PageState.Action); } var moduleType = Type.GetType(typename); if (moduleType != null) { bool authorized = false; if (Constants.DefaultModuleActions.Contains(PageState.Action)) { authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions); } else { switch (module.SecurityAccessLevel) { case SecurityAccessLevel.Anonymous: authorized = true; break; case SecurityAccessLevel.View: authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions); break; case SecurityAccessLevel.Edit: authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, module.Permissions); break; case SecurityAccessLevel.Admin: authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole); break; case SecurityAccessLevel.Host: authorized = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole); break; } } if (authorized) { if (!Constants.DefaultModuleActions.Contains(PageState.Action) && module.ControlTitle != "") { module.Title = module.ControlTitle; } CreateComponent(builder, module); } } else { // module control does not exist with name specified } } } } else { if (PageState.ModuleId != -1) { Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId); if (module != null && module.Pane.ToLower() == Name.ToLower() && !module.IsDeleted) { // check if user is authorized to view module if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions)) { CreateComponent(builder, module); } } } else { foreach (Module module in PageState.Modules.Where(item => item.PageId == PageState.Page.PageId && item.Pane.ToLower() == Name.ToLower() && !item.IsDeleted).OrderBy(x => x.Order).ToArray()) { // check if user is authorized to view module if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions)) { CreateComponent(builder, module); } } } } }; }
private async Task Refresh() { Alias alias = null; Site site; List <Page> pages; Page page; User user = null; List <Module> modules; var moduleid = -1; var action = string.Empty; var urlparameters = string.Empty; var editmode = false; var reload = Reload.None; var lastsyncdate = DateTime.UtcNow; var runtime = GetRuntime(); Uri uri = new Uri(_absoluteUri); // get path var path = uri.LocalPath.Substring(1); // parse querystring var querystring = ParseQueryString(uri.Query); // the reload parameter is used to reload the PageState if (querystring.ContainsKey("reload")) { reload = Reload.Site; } if (PageState != null) { editmode = PageState.EditMode; lastsyncdate = PageState.LastSyncDate; } alias = await AliasService.GetAliasAsync(path, lastsyncdate); SiteState.Alias = alias; // set state for services lastsyncdate = alias.SyncDate; // process any sync events for site or page if (reload != Reload.Site && alias.SyncEvents.Any()) { if (PageState != null && alias.SyncEvents.Exists(item => item.EntityName == EntityNames.Page && item.EntityId == PageState.Page.PageId)) { reload = Reload.Page; } if (alias.SyncEvents.Exists(item => item.EntityName == EntityNames.Site && item.EntityId == alias.SiteId)) { reload = Reload.Site; } } if (reload == Reload.Site || PageState == null || alias.SiteId != PageState.Alias.SiteId) { site = await SiteService.GetSiteAsync(alias.SiteId); reload = Reload.Site; } else { site = PageState.Site; } if (site != null) { if (PageState == null || reload == Reload.Site) { // get user var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); if (authState.User.Identity.IsAuthenticated) { user = await UserService.GetUserAsync(authState.User.Identity.Name, site.SiteId); } } else { user = PageState.User; } // process any sync events for user if (reload != Reload.Site && user != null && alias.SyncEvents.Any()) { if (alias.SyncEvents.Exists(item => item.EntityName == EntityNames.User && item.EntityId == user.UserId)) { reload = Reload.Site; } } if (PageState == null || reload >= Reload.Site) { pages = await PageService.GetPagesAsync(site.SiteId); } else { pages = PageState.Pages; } // format path and remove alias path = path.Replace("//", "/"); if (!path.EndsWith("/")) { path += "/"; } if (alias.Path != "") { path = path.Substring(alias.Path.Length + 1); } // extract admin route elements from path var segments = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); int result; int modIdPos = 0; int actionPos = 0; int urlParametersPos = 0; for (int i = 0; i < segments.Length; i++) { if (segments[i] == Constants.UrlParametersDelimiter) { urlParametersPos = i + 1; } if (i >= urlParametersPos && urlParametersPos != 0) { urlparameters += "/" + segments[i]; } if (segments[i] == Constants.ModuleDelimiter) { modIdPos = i + 1; actionPos = modIdPos + 1; if (actionPos > segments.Length - 1) { action = Constants.DefaultAction; } else { action = segments[actionPos]; } } } // check if path has moduleid and action specification ie. pagename/moduleid/action/ if (modIdPos > 0) { int.TryParse(segments[modIdPos], out result); moduleid = result; if (actionPos > segments.Length - 1) { path = path.Replace(segments[modIdPos - 1] + "/" + segments[modIdPos] + "/", ""); } else { path = path.Replace(segments[modIdPos - 1] + "/" + segments[modIdPos] + "/" + segments[actionPos] + "/", ""); } } if (urlParametersPos > 0) { path = path.Replace(segments[urlParametersPos - 1] + urlparameters + "/", ""); } // remove trailing slash so it can be used as a key for Pages if (path.EndsWith("/")) { path = path.Substring(0, path.Length - 1); } if (PageState == null || reload >= Reload.Page) { page = pages.Where(item => item.Path == path).FirstOrDefault(); } else { page = PageState.Page; } // failsafe in case router cannot locate the home page for the site if (page == null && path == "") { page = pages.FirstOrDefault(); path = page.Path; } // check if page has changed if (page != null && page.Path != path) { page = pages.Where(item => item.Path == path).FirstOrDefault(); reload = Reload.Page; editmode = false; } if (page != null) { if (PageState == null) { editmode = false; } // check if user is authorized to view page if (UserSecurity.IsAuthorized(user, PermissionNames.View, page.Permissions)) { page = await ProcessPage(page, site, user); if (PageState != null && (PageState.ModuleId != moduleid || PageState.Action != action)) { reload = Reload.Page; } if (PageState == null || reload >= Reload.Page) { modules = await ModuleService.GetModulesAsync(site.SiteId); (page, modules) = ProcessModules(page, modules, moduleid, action, (!string.IsNullOrEmpty(page.DefaultContainerType)) ? page.DefaultContainerType : site.DefaultContainerType); } else { modules = PageState.Modules; } _pagestate = new PageState { Alias = alias, Site = site, Pages = pages, Page = page, User = user, Modules = modules, Uri = new Uri(_absoluteUri, UriKind.Absolute), QueryString = querystring, UrlParameters = urlparameters, ModuleId = moduleid, Action = action, EditMode = editmode, LastSyncDate = lastsyncdate, Runtime = runtime }; OnStateChange?.Invoke(_pagestate); } } else { if (user == null) { // redirect to login page NavigationManager.NavigateTo(Utilities.NavigateUrl(alias.Path, "login", "returnurl=" + path)); } else { await LogService.Log(null, null, user.UserId, GetType().AssemblyQualifiedName, Utilities.GetTypeNameLastSegment(GetType().AssemblyQualifiedName, 1), LogFunction.Security, LogLevel.Error, null, "Page Does Not Exist Or User Is Not Authorized To View Page {Path}", path); if (path != "") { // redirect to home page NavigationManager.NavigateTo(Utilities.NavigateUrl(alias.Path, "", "")); } } } } else { // site does not exist } }
protected virtual List <ActionViewModel> GetActions() { var actionList = new List <ActionViewModel>(); if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions)) { actionList.Add(new ActionViewModel { Name = "Manage Settings", Action = async(u, m) => await Settings(u, m) }); if (ModuleState.ModuleDefinition != null && ModuleState.ModuleDefinition.ServerManagerType != "") { actionList.Add(new ActionViewModel { Name = "Import Content", Action = async(u, m) => await EditUrlAsync(u, m.ModuleId, "Import") }); actionList.Add(new ActionViewModel { Name = "Export Content", Action = async(u, m) => await EditUrlAsync(u, m.ModuleId, "Export") }); } actionList.Add(new ActionViewModel { Name = "Delete Module", Action = async(u, m) => await DeleteModule(u, m) }); actionList.Add(new ActionViewModel { Name = "" }); if (ModuleState.PaneModuleIndex > 0) { actionList.Add(new ActionViewModel { Name = "Move To Top", Action = async(s, m) => await MoveTop(s, m) }); } if (ModuleState.PaneModuleIndex > 0) { actionList.Add(new ActionViewModel { Name = "Move Up", Action = async(s, m) => await MoveUp(s, m) }); } if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1)) { actionList.Add(new ActionViewModel { Name = "Move Down", Action = async(s, m) => await MoveDown(s, m) }); } if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1)) { actionList.Add(new ActionViewModel { Name = "Move To Bottom", Action = async(s, m) => await MoveBottom(s, m) }); } foreach (string pane in PageState.Page.Panes.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { if (pane != ModuleState.Pane) { actionList.Add(new ActionViewModel { Name = "Move To " + pane + " Pane", Action = async(s, m) => await MoveToPane(s, pane, m) }); } } } return(actionList); }
#pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { #line 5 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions)) { #line default #line hidden __builder.AddContent(0, " "); __builder.OpenElement(1, "div"); __builder.AddAttribute(2, "class", "app-moduleactions"); __builder.AddMarkupContent(3, "\n <a class=\"nav-link dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\"></a>\n "); __builder.OpenElement(4, "div"); __builder.AddAttribute(5, "class", "dropdown-menu"); __builder.AddAttribute(6, "x-placement", "bottom-start"); __builder.AddAttribute(7, "style", "position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);"); __builder.AddMarkupContent(8, "\n"); #line 10 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" foreach (var action in Actions) { if (string.IsNullOrEmpty(action.Name)) { #line default #line hidden __builder.AddMarkupContent(9, " <div class=\"dropdown-divider\"></div>\n"); #line 15 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" } else { #line default #line hidden __builder.AddContent(10, " "); __builder.OpenElement(11, "a"); __builder.AddAttribute(12, "class", "dropdown-item"); __builder.AddAttribute(13, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create <Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, #line 18 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" (async() => await ModuleAction(action)) #line default #line hidden )); __builder.AddMarkupContent(14, "\n"); #line 19 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" if (string.IsNullOrEmpty(action.Icon)) { #line default #line hidden __builder.AddContent(15, #line 21 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" (MarkupString)" " #line default #line hidden ); #line 21 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" ; } else { #line default #line hidden __builder.AddContent(16, " "); __builder.OpenElement(17, "span"); __builder.AddAttribute(18, "class", "oi" + " oi-" + ( #line 25 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" action.Icon #line default #line hidden )); __builder.AddAttribute(19, "aria-hidden", "true"); __builder.CloseElement(); __builder.AddMarkupContent(20, "\n"); #line 26 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" } #line default #line hidden __builder.AddMarkupContent(21, " \n "); __builder.AddContent(22, #line 28 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" action.Name #line default #line hidden ); __builder.AddMarkupContent(23, "\n "); __builder.CloseElement(); __builder.AddMarkupContent(24, "\n"); #line 30 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" } } #line default #line hidden __builder.AddContent(25, " "); __builder.CloseElement(); __builder.AddMarkupContent(26, "\n "); __builder.CloseElement(); __builder.AddMarkupContent(27, "\n"); #line 34 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Themes/Controls/ModuleActions.razor" } #line default #line hidden }
#pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __builder.OpenComponent <Oqtane.Modules.Controls.TabStrip>(0); __builder.AddAttribute(1, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { __builder2.AddMarkupContent(2, "\n "); __builder2.OpenComponent <Oqtane.Modules.Controls.TabPanel>(3); __builder2.AddAttribute(4, "Name", "Settings"); __builder2.AddAttribute(5, "Heading", "Module Settings"); __builder2.AddAttribute(6, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => { __builder3.AddMarkupContent(7, "\n"); #line 10 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" if (_containers != null) { #line default #line hidden __builder3.AddContent(8, " "); __builder3.OpenElement(9, "table"); __builder3.AddAttribute(10, "class", "table table-borderless"); __builder3.AddMarkupContent(11, "\n "); __builder3.OpenElement(12, "tr"); __builder3.AddMarkupContent(13, "\n "); __builder3.OpenElement(14, "td"); __builder3.AddMarkupContent(15, "\n "); __builder3.OpenComponent <Oqtane.Modules.Controls.Label>(16); __builder3.AddAttribute(17, "For", "title"); __builder3.AddAttribute(18, "HelpText", "Enter the title of the module"); __builder3.AddAttribute(19, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => { __builder4.AddContent(20, "Title: "); } )); __builder3.CloseComponent(); __builder3.AddMarkupContent(21, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(22, "\n "); __builder3.OpenElement(23, "td"); __builder3.AddMarkupContent(24, "\n "); __builder3.OpenElement(25, "input"); __builder3.AddAttribute(26, "id", "title"); __builder3.AddAttribute(27, "type", "text"); __builder3.AddAttribute(28, "name", "Title"); __builder3.AddAttribute(29, "class", "form-control"); __builder3.AddAttribute(30, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue( #line 18 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _title #line default #line hidden )); __builder3.AddAttribute(31, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => _title = __value, _title)); __builder3.SetUpdatesAttributeName("value"); __builder3.CloseElement(); __builder3.AddMarkupContent(32, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(33, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(34, "\n "); __builder3.OpenElement(35, "tr"); __builder3.AddMarkupContent(36, "\n "); __builder3.OpenElement(37, "td"); __builder3.AddMarkupContent(38, "\n "); __builder3.OpenComponent <Oqtane.Modules.Controls.Label>(39); __builder3.AddAttribute(40, "For", "container"); __builder3.AddAttribute(41, "HelpText", "Select the module\'s container"); __builder3.AddAttribute(42, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => { __builder4.AddContent(43, "Container: "); } )); __builder3.CloseComponent(); __builder3.AddMarkupContent(44, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(45, "\n "); __builder3.OpenElement(46, "td"); __builder3.AddMarkupContent(47, "\n "); __builder3.OpenElement(48, "select"); __builder3.AddAttribute(49, "id", "container"); __builder3.AddAttribute(50, "class", "form-control"); __builder3.AddAttribute(51, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue( #line 26 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _containerType #line default #line hidden )); __builder3.AddAttribute(52, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => _containerType = __value, _containerType)); __builder3.SetUpdatesAttributeName("value"); __builder3.AddMarkupContent(53, "\n "); __builder3.OpenElement(54, "option"); __builder3.AddAttribute(55, "value", "-"); __builder3.AddContent(56, "<Inherit From Page Or Site>"); __builder3.CloseElement(); __builder3.AddMarkupContent(57, "\n"); #line 28 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" foreach (var container in _containers) { #line default #line hidden __builder3.AddContent(58, " "); __builder3.OpenElement(59, "option"); __builder3.AddAttribute(60, "value", #line 30 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" container.TypeName #line default #line hidden ); __builder3.AddContent(61, #line 30 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" container.Name #line default #line hidden ); __builder3.CloseElement(); __builder3.AddMarkupContent(62, "\n"); #line 31 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" } #line default #line hidden __builder3.AddContent(63, " "); __builder3.CloseElement(); __builder3.AddMarkupContent(64, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(65, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(66, "\n "); __builder3.OpenElement(67, "tr"); __builder3.AddMarkupContent(68, "\n "); __builder3.OpenElement(69, "td"); __builder3.AddMarkupContent(70, "\n "); __builder3.OpenComponent <Oqtane.Modules.Controls.Label>(71); __builder3.AddAttribute(72, "For", "allpages"); __builder3.AddAttribute(73, "HelpText", "Indicate if this module should be displayed on all pages"); __builder3.AddAttribute(74, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => { __builder4.AddContent(75, "Display On All Pages? "); } )); __builder3.CloseComponent(); __builder3.AddMarkupContent(76, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(77, "\n "); __builder3.OpenElement(78, "td"); __builder3.AddMarkupContent(79, "\n "); __builder3.OpenElement(80, "select"); __builder3.AddAttribute(81, "id", "allpages"); __builder3.AddAttribute(82, "class", "form-control"); __builder3.AddAttribute(83, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue( #line 40 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _allPages #line default #line hidden )); __builder3.AddAttribute(84, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => _allPages = __value, _allPages)); __builder3.SetUpdatesAttributeName("value"); __builder3.AddMarkupContent(85, "\n "); __builder3.OpenElement(86, "option"); __builder3.AddAttribute(87, "value", "True"); __builder3.AddContent(88, "Yes"); __builder3.CloseElement(); __builder3.AddMarkupContent(89, "\n "); __builder3.OpenElement(90, "option"); __builder3.AddAttribute(91, "value", "False"); __builder3.AddContent(92, "No"); __builder3.CloseElement(); __builder3.AddMarkupContent(93, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(94, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(95, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(96, "\n "); __builder3.OpenElement(97, "tr"); __builder3.AddMarkupContent(98, "\n "); __builder3.OpenElement(99, "td"); __builder3.AddMarkupContent(100, "\n "); __builder3.OpenComponent <Oqtane.Modules.Controls.Label>(101); __builder3.AddAttribute(102, "For", "page"); __builder3.AddAttribute(103, "HelpText", "The page that the module is on"); __builder3.AddAttribute(104, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => { __builder4.AddContent(105, "Page: "); } )); __builder3.CloseComponent(); __builder3.AddMarkupContent(106, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(107, "\n "); __builder3.OpenElement(108, "td"); __builder3.AddMarkupContent(109, "\n "); __builder3.OpenElement(110, "select"); __builder3.AddAttribute(111, "id", "page"); __builder3.AddAttribute(112, "class", "form-control"); __builder3.AddAttribute(113, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue( #line 51 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _pageId #line default #line hidden )); __builder3.AddAttribute(114, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => _pageId = __value, _pageId)); __builder3.SetUpdatesAttributeName("value"); __builder3.AddMarkupContent(115, "\n"); #line 52 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" foreach (Page p in PageState.Pages) { if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions)) { #line default #line hidden __builder3.AddContent(116, " "); __builder3.OpenElement(117, "option"); __builder3.AddAttribute(118, "value", #line 56 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" p.PageId #line default #line hidden ); __builder3.AddContent(119, #line 56 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" new string('-', p.Level * 2) #line default #line hidden ); __builder3.AddContent(120, #line 56 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" p.Name #line default #line hidden ); __builder3.CloseElement(); __builder3.AddMarkupContent(121, "\n"); #line 57 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" } } #line default #line hidden __builder3.AddContent(122, " "); __builder3.CloseElement(); __builder3.AddMarkupContent(123, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(124, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(125, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(126, "\n"); #line 63 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" } #line default #line hidden __builder3.AddContent(127, " "); } )); __builder2.CloseComponent(); __builder2.AddMarkupContent(128, "\n "); __builder2.OpenComponent <Oqtane.Modules.Controls.TabPanel>(129); __builder2.AddAttribute(130, "Name", "Permissions"); __builder2.AddAttribute(131, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => { __builder3.AddMarkupContent(132, "\n"); #line 66 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" if (_permissions != null) { #line default #line hidden __builder3.AddContent(133, " "); __builder3.OpenElement(134, "table"); __builder3.AddAttribute(135, "class", "table table-borderless"); __builder3.AddMarkupContent(136, "\n "); __builder3.OpenElement(137, "tr"); __builder3.AddMarkupContent(138, "\n "); __builder3.OpenElement(139, "td"); __builder3.AddMarkupContent(140, "\n "); __builder3.OpenComponent <Oqtane.Modules.Controls.PermissionGrid>(141); __builder3.AddAttribute(142, "EntityName", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck <System.String>( #line 71 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" EntityNames.Module #line default #line hidden )); __builder3.AddAttribute(143, "PermissionNames", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck <System.String>( #line 71 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _permissionNames #line default #line hidden )); __builder3.AddAttribute(144, "Permissions", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck <System.String>( #line 71 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _permissions #line default #line hidden )); __builder3.AddComponentReferenceCapture(145, (__value) => { #line 71 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _permissionGrid = (Oqtane.Modules.Controls.PermissionGrid)__value; #line default #line hidden } ); __builder3.CloseComponent(); __builder3.AddMarkupContent(146, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(147, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(148, "\n "); __builder3.CloseElement(); __builder3.AddMarkupContent(149, "\n"); #line 75 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" } #line default #line hidden __builder3.AddContent(150, " "); } )); __builder2.CloseComponent(); __builder2.AddMarkupContent(151, "\n"); #line 77 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" if (_settingsModuleType != null) { #line default #line hidden __builder2.AddContent(152, " "); __builder2.OpenComponent <Oqtane.Modules.Controls.TabPanel>(153); __builder2.AddAttribute(154, "Name", "ModuleSettings"); __builder2.AddAttribute(155, "Heading", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck <System.String>( #line 79 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" _settingstitle #line default #line hidden )); __builder2.AddAttribute(156, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => { __builder3.AddMarkupContent(157, "\n "); __builder3.AddContent(158, #line 80 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" DynamicComponent #line default #line hidden ); __builder3.AddMarkupContent(159, "\n "); } )); __builder2.CloseComponent(); __builder2.AddMarkupContent(160, "\n"); #line 82 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" } #line default #line hidden } )); __builder.CloseComponent(); __builder.AddMarkupContent(161, "\n"); __builder.OpenElement(162, "button"); __builder.AddAttribute(163, "type", "button"); __builder.AddAttribute(164, "class", "btn btn-success"); __builder.AddAttribute(165, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create <Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, #line 84 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" SaveModule #line default #line hidden )); __builder.AddContent(166, "Save"); __builder.CloseElement(); __builder.AddMarkupContent(167, "\n"); __builder.OpenComponent <Microsoft.AspNetCore.Components.Routing.NavLink>(168); __builder.AddAttribute(169, "class", "btn btn-secondary"); __builder.AddAttribute(170, "href", #line 85 "/Users/cam/Desktop/oqtane/oqtane-theme-test/Oqtane.Client/Modules/Admin/Modules/Settings.razor" NavigateUrl() #line default #line hidden ); __builder.AddAttribute(171, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { __builder2.AddContent(172, "Cancel"); } )); __builder.CloseComponent(); }