Fixes tree for single tree sections, fixes creating a user group so you can select default permissions

This commit is contained in:
Shannon
2017-07-03 16:31:47 +10:00
parent 247ca906aa
commit ff02b28d26
5 changed files with 23 additions and 20 deletions

View File

@@ -573,7 +573,6 @@
<Content Include="Umbraco\Developer\Packages\installer.aspx" />
<Content Include="Umbraco\Logout.aspx" />
<Content Include="Umbraco\umbraco.aspx" />
<Content Include="Umbraco\Users\EditUserGroup.aspx" />
<Content Include="Umbraco_Client\Application\JQuery\jquery.unobtrusive-ajax.min.js" />
<Content Include="Umbraco_Client\IconPicker\iconpicker.js" />
<Compile Include="Umbraco\umbraco.aspx.cs">
@@ -583,13 +582,6 @@
<Compile Include="Umbraco\umbraco.aspx.designer.cs">
<DependentUpon>umbraco.aspx</DependentUpon>
</Compile>
<Compile Include="Umbraco\Users\EditUser.aspx.cs">
<DependentUpon>EditUser.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Umbraco\Users\EditUser.aspx.designer.cs">
<DependentUpon>EditUser.aspx</DependentUpon>
</Compile>
<Content Include="Config\Splashes\booting.aspx" />
<Content Include="Config\Splashes\noNodes.aspx" />
<Content Include="Umbraco\Dashboard\UserControlProxy.aspx" />
@@ -1011,10 +1003,6 @@
<None Include="Umbraco\Scripting\Templates\Rb\SubpagesAsThumnbnails.rb" />
<None Include="Umbraco\Scripting\Templates\Rb\SubpagesFromAChangeableSource.rb" />
<None Include="Umbraco\Scripting\Templates\Rb\SubpagesFromCurrentPage.rb" />
<Content Include="Umbraco\Users\NodePermissions.ascx" />
<Content Include="Umbraco\Users\PermissionEditor.aspx" />
<Content Include="Umbraco\Users\PermissionsEditor.js" />
<Content Include="Umbraco\Users\PermissionsHandler.asmx" />
<Content Include="Umbraco\Webservices\CheckForUpgrade.asmx" />
<Content Include="Umbraco\Xslt\searchResult.xslt" />
<Content Include="Umbraco\Xslt\Templates\RelatedLinks.xslt" />
@@ -1068,7 +1056,6 @@
<Content Include="Umbraco\Dialogs\sort.aspx" />
<Content Include="Umbraco\tree.aspx" />
<Content Include="Umbraco\treeInit.aspx" />
<Content Include="Umbraco\Users\EditUser.aspx" />
<!--<Content Include="Umbraco\users\PermissionEditor.aspx" />-->
<Content Include="Umbraco\Webservices\ajax.js" />
<Content Include="Umbraco\Webservices\CacheRefresher.asmx">

View File

@@ -39,7 +39,7 @@ namespace Umbraco.Web.Editors
/// <returns></returns>
public UserGroupDisplay GetEmptyUserGroup()
{
return new UserGroupDisplay();
return Mapper.Map<UserGroupDisplay>(new UserGroup());
}
/// <summary>

View File

@@ -46,7 +46,7 @@ namespace Umbraco.Web.Models.Mapping
: attribute.Name;
result.Description = _textService.Localize(String.Format("actionDescriptions/{0}", action.Alias));
result.Icon = action.Icon;
result.Checked = source.Permissions.Contains(action.Letter.ToString(CultureInfo.InvariantCulture));
result.Checked = source.Permissions != null && source.Permissions.Contains(action.Letter.ToString(CultureInfo.InvariantCulture));
result.PermissionCode = action.Letter.ToString(CultureInfo.InvariantCulture);
return result;
}

View File

@@ -30,7 +30,7 @@ namespace Umbraco.Web.Security
public WebSecurity(HttpContextBase httpContext, ApplicationContext applicationContext)
{
_httpContext = httpContext;
_applicationContext = applicationContext;
_applicationContext = applicationContext;
}
/// <summary>

View File

@@ -42,7 +42,7 @@ namespace Umbraco.Web.Trees
//find all tree definitions that have the current application alias
var appTrees = ApplicationContext.Current.Services.ApplicationTreeService.GetApplicationTrees(application, onlyInitialized).ToArray();
if (appTrees.Count() == 1 || string.IsNullOrEmpty(tree) == false )
if (string.IsNullOrEmpty(tree) == false || appTrees.Length == 1)
{
var apptree = string.IsNullOrEmpty(tree) == false
? appTrees.SingleOrDefault(x => x.Alias == tree)
@@ -55,11 +55,12 @@ namespace Umbraco.Web.Trees
Constants.System.Root.ToString(CultureInfo.InvariantCulture),
queryStrings,
application);
return result;
//this will be null if it cannot convert to ta single root section
if (result != null)
return result;
}
var collection = new TreeNodeCollection();
foreach (var apptree in appTrees)
{
@@ -107,6 +108,7 @@ namespace Umbraco.Web.Trees
/// <param name="configTree"></param>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <param name="application"></param>
/// <returns></returns>
private async Task<SectionRootNode> GetRootForSingleAppTree(ApplicationTree configTree, string id, FormDataCollection queryStrings, string application)
{
@@ -121,6 +123,16 @@ namespace Umbraco.Web.Trees
//This should really never happen if we've successfully got the children above.
throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias);
}
//if the root node has a route path, we cannot create a single root section because by specifying the route path this would
//override the dashboard route and that means there can be no dashboard for that section which is a breaking change.
if (rootNode.Result.RoutePath.IsNullOrWhiteSpace() == false
&& rootNode.Result.RoutePath != "#"
&& rootNode.Result.RoutePath != application)
{
//null indicates this cannot be converted
return null;
}
var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot(
rootId,
@@ -128,6 +140,10 @@ namespace Umbraco.Web.Trees
rootNode.Result.MenuUrl,
rootNode.Result.Name,
byControllerAttempt.Result);
//This can't be done currently because the root will default to routing to a dashboard and if we disable dashboards for a section
//that is really considered a breaking change. See above.
//sectionRoot.RoutePath = rootNode.Result.RoutePath;
foreach (var d in rootNode.Result.AdditionalData)
{