From 6f81b7fe2474fd6a2e40ea83b7e257eed1259f21 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 25 Jan 2018 12:10:34 +0100 Subject: [PATCH] 'getting-started' tour only available to admins --- src/Umbraco.Web/Editors/TourController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/Editors/TourController.cs b/src/Umbraco.Web/Editors/TourController.cs index 152879bf5a..0833d26cb2 100644 --- a/src/Umbraco.Web/Editors/TourController.cs +++ b/src/Umbraco.Web/Editors/TourController.cs @@ -17,13 +17,16 @@ namespace Umbraco.Web.Editors { public IEnumerable GetTours() { + //Check if it has admin group + var isAdmin = UmbracoContext.Current.Security.CurrentUser.Groups.Any(x => x.Alias == "admin"); + var result = new List(); if (UmbracoConfig.For.UmbracoSettings().BackOffice.Tours.EnableTours == false) return result; var filters = TourFilterResolver.Current.Filters.ToList(); - + //get all filters that will be applied to all tour aliases var aliasOnlyFilters = filters.Where(x => x.PluginName == null && x.TourFileName == null).ToList(); @@ -36,6 +39,10 @@ namespace Umbraco.Web.Editors { foreach (var tourFile in Directory.EnumerateFiles(coreToursPath, "*.json")) { + var tourFileName = Path.GetFileName(tourFile.TrimEnd('\\')); + //We brake if isAdmin is false as we don't want to show getting-started tour to non-admins + if (tourFileName.Equals("getting-started.json") && isAdmin == false) break; + TryParseTourFile(tourFile, result, nonPluginFilters, aliasOnlyFilters); } } @@ -79,7 +86,7 @@ namespace Umbraco.Web.Editors //get the filters specific to this file var fileFilters = filters.Where(x => x.TourFileName != null && x.TourFileName.IsMatch(fileName)).ToList(); - + //If there is any filter applied to match the file only (no tour alias) then ignore the file entirely var isFileFiltered = fileFilters.Any(x => x.TourAlias == null); if (isFileFiltered) return; @@ -117,4 +124,4 @@ namespace Umbraco.Web.Editors } } } -} \ No newline at end of file +}