Merge pull request #2422 from umbraco/temp-U4-10869
U4-10869 Make sure the getting started tour is only shown to the right users
This commit is contained in:
@@ -212,6 +212,9 @@
|
||||
throw "Tour " + tour.alias + " is missing tour steps";
|
||||
}
|
||||
|
||||
if (tour.requiredSections.length === 0) {
|
||||
throw "Tour " + tour.alias + " is missing the required sections";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,4 +278,4 @@
|
||||
|
||||
angular.module("umbraco.services").factory("tourService", tourService);
|
||||
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
"group": "Getting Started",
|
||||
"groupOrder": 100,
|
||||
"allowDisable": true,
|
||||
"requiredSections": [
|
||||
"content",
|
||||
"media",
|
||||
"settings",
|
||||
"developer",
|
||||
"users",
|
||||
"member",
|
||||
"forms"
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"title": "Welcome to Umbraco - The Friendly CMS",
|
||||
@@ -25,7 +34,6 @@
|
||||
"content": "Each area in Umbraco is called a <b>Section</b>. Right now you are in the Content section, when you want to go to another section simply click on the appropriate icon in the main menu and you'll be there in no time.",
|
||||
"backdropOpacity": 0.6
|
||||
},
|
||||
|
||||
{
|
||||
"element": "#tree",
|
||||
"elementPreventClick": true,
|
||||
@@ -88,6 +96,15 @@
|
||||
"alias": "umbIntroCreateDocType",
|
||||
"group": "Getting Started",
|
||||
"groupOrder": 100,
|
||||
"requiredSections": [
|
||||
"content",
|
||||
"media",
|
||||
"settings",
|
||||
"developer",
|
||||
"users",
|
||||
"member",
|
||||
"forms"
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"title": "Create your first Document Type",
|
||||
@@ -203,6 +220,15 @@
|
||||
"alias": "umbIntroCreateContent",
|
||||
"group": "Getting Started",
|
||||
"groupOrder": 100,
|
||||
"requiredSections": [
|
||||
"content",
|
||||
"media",
|
||||
"settings",
|
||||
"developer",
|
||||
"users",
|
||||
"member",
|
||||
"forms"
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"title": "Creating your first content node",
|
||||
@@ -253,6 +279,15 @@
|
||||
"alias": "umbIntroRenderInTemplate",
|
||||
"group": "Getting Started",
|
||||
"groupOrder": 100,
|
||||
"requiredSections": [
|
||||
"content",
|
||||
"media",
|
||||
"settings",
|
||||
"developer",
|
||||
"users",
|
||||
"member",
|
||||
"forms"
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"title": "Render your content in a template",
|
||||
@@ -299,6 +334,15 @@
|
||||
"alias": "umbIntroViewHomePage",
|
||||
"group": "Getting Started",
|
||||
"groupOrder": 100,
|
||||
"requiredSections": [
|
||||
"content",
|
||||
"media",
|
||||
"settings",
|
||||
"developer",
|
||||
"users",
|
||||
"member",
|
||||
"forms"
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"title": "View your Umbraco site",
|
||||
@@ -339,6 +383,15 @@
|
||||
"alias": "umbIntroMediaSection",
|
||||
"group": "Getting Started",
|
||||
"groupOrder": 100,
|
||||
"requiredSections": [
|
||||
"content",
|
||||
"media",
|
||||
"settings",
|
||||
"developer",
|
||||
"users",
|
||||
"member",
|
||||
"forms"
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"title": "How to use the media library",
|
||||
|
||||
@@ -7,8 +7,6 @@ using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
@@ -23,7 +21,7 @@ namespace Umbraco.Web.Editors
|
||||
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();
|
||||
|
||||
@@ -64,8 +62,28 @@ namespace Umbraco.Web.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
//Get all allowed sections for the current user
|
||||
var allowedSections = UmbracoContext.Current.Security.CurrentUser.AllowedSections.ToList();
|
||||
|
||||
return result.OrderBy(x => x.FileName, StringComparer.InvariantCultureIgnoreCase);
|
||||
var toursToBeRemoved = new List<BackOfficeTourFile>();
|
||||
|
||||
//Checking to see if the user has access to the required tour sections, else we remove the tour
|
||||
foreach (var backOfficeTourFile in result)
|
||||
{
|
||||
foreach (var tour in backOfficeTourFile.Tours)
|
||||
{
|
||||
foreach (var toursRequiredSection in tour.RequiredSections)
|
||||
{
|
||||
if (allowedSections.Contains(toursRequiredSection) == false)
|
||||
{
|
||||
toursToBeRemoved.Add(backOfficeTourFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result.Except(toursToBeRemoved).OrderBy(x => x.FileName, StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
private void TryParseTourFile(string tourFile,
|
||||
@@ -79,7 +97,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 +135,4 @@ namespace Umbraco.Web.Editors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
@@ -18,6 +19,8 @@ namespace Umbraco.Web.Models
|
||||
public int GroupOrder { get; set; }
|
||||
[DataMember(Name = "allowDisable")]
|
||||
public bool AllowDisable { get; set; }
|
||||
[DataMember(Name = "requiredSections")]
|
||||
public List<string> RequiredSections { get; set; }
|
||||
[DataMember(Name = "steps")]
|
||||
public BackOfficeTourStep[] Steps { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user