@@ -15,7 +15,7 @@ namespace umbraco.IO
|
||||
{
|
||||
get
|
||||
{
|
||||
return SystemDirectories.Data + "/access.xml";
|
||||
return SystemDirectories.Data + "/access.config";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Data;
|
||||
using umbraco.DataLayer;
|
||||
using System.Collections;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
|
||||
namespace umbraco.cms.businesslogic.member
|
||||
{
|
||||
@@ -15,6 +16,7 @@ namespace umbraco.cms.businesslogic.member
|
||||
public class MemberGroup : CMSNode
|
||||
{
|
||||
private static Guid _objectType = new Guid("366e63b9-880f-4e13-a61c-98069b029728");
|
||||
private string _oldGroupName;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a new object of the MemberGroup class
|
||||
@@ -34,6 +36,20 @@ namespace umbraco.cms.businesslogic.member
|
||||
|
||||
}
|
||||
|
||||
public override string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
// in order to be able to update access.xml if name changes we need to store a reference to the old name
|
||||
_oldGroupName = Text;
|
||||
base.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deltes the current membergroup
|
||||
/// </summary>
|
||||
@@ -62,6 +78,12 @@ namespace umbraco.cms.businesslogic.member
|
||||
SaveEventArgs e = new SaveEventArgs();
|
||||
FireBeforeSave(e);
|
||||
|
||||
// if the name has changed we need to update the public access
|
||||
if (_oldGroupName != Text)
|
||||
{
|
||||
Access.RenameMemberShipRole(_oldGroupName, Text);
|
||||
}
|
||||
|
||||
if (!e.Cancel) {
|
||||
FireAfterSave(e);
|
||||
}
|
||||
|
||||
@@ -180,6 +180,24 @@ namespace umbraco.cms.businesslogic.web
|
||||
new Access().FireAfterRemoveMemberShipRoleFromDocument(new Document(documentId), role, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool RenameMemberShipRole(string oldRolename, string newRolename)
|
||||
{
|
||||
bool hasChange = false;
|
||||
if (oldRolename != newRolename)
|
||||
{
|
||||
foreach (XmlNode x in AccessXml.SelectNodes("//group [@id = '" + oldRolename + "']"))
|
||||
{
|
||||
x.Attributes["id"].Value = newRolename;
|
||||
hasChange = true;
|
||||
}
|
||||
if (hasChange)
|
||||
save();
|
||||
}
|
||||
|
||||
return hasChange;
|
||||
|
||||
}
|
||||
|
||||
public static void ProtectPage(bool Simple, int DocumentId, int LoginDocumentId, int ErrorDocumentId)
|
||||
{
|
||||
|
||||
@@ -107,13 +107,21 @@ namespace umbraco.presentation.install
|
||||
loadContent();
|
||||
break;
|
||||
case "detect":
|
||||
step.Value = "validatePermissions";
|
||||
// upgrade!
|
||||
if (!String.IsNullOrEmpty(GlobalSettings.ConfigurationStatus.Trim()))
|
||||
step.Value = "renaming";
|
||||
else
|
||||
step.Value = "validatePermissions";
|
||||
loadContent();
|
||||
break;
|
||||
case "upgradeIndex":
|
||||
step.Value = "validatePermissions";
|
||||
loadContent();
|
||||
break;
|
||||
case "renaming" :
|
||||
step.Value = "validatePermissions";
|
||||
loadContent();
|
||||
break;
|
||||
case "validatePermissions":
|
||||
step.Value = "defaultUser";
|
||||
loadContent();
|
||||
|
||||
25
umbraco/presentation/install/steps/renaming.ascx
Normal file
25
umbraco/presentation/install/steps/renaming.ascx
Normal file
@@ -0,0 +1,25 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="renaming.ascx.cs" Inherits="umbraco.presentation.install.steps.renaming" %>
|
||||
<h1>Step 3/5: Updating old conventions</h1>
|
||||
<asp:Panel ID="init" Runat="server" Visible="True">
|
||||
<p>
|
||||
This version of Umbraco introduces new conventions for naming XSLT and REST extensions as well as a renaming of the Public Access storage file.<br />
|
||||
You no longer need to prefix your extension references with /bin and the public access storage file is now called access.config instead of access.xml.<br />
|
||||
This step of the installer will try to update your old references. If it fails due to permission settings, you'll need to make these changes manually!
|
||||
</p>
|
||||
|
||||
<asp:Panel ID="noChangedNeeded" runat="server" Visible="false">
|
||||
<p><strong>Everything looks good. No changes needed for the upgrade, just press next.</strong></p>
|
||||
</asp:Panel>
|
||||
<asp:Panel ID="changesNeeded" runat="server" Visible="true">
|
||||
<p>
|
||||
<strong>The following changes will need to be made. Press to update changes button to proceed:</strong>
|
||||
</p>
|
||||
<asp:Literal id="identifyResult" Runat="server"></asp:Literal>
|
||||
<asp:Button ID="updateChanges" runat="server" Text="Update Changes"
|
||||
onclick="updateChanges_Click" />
|
||||
</asp:Panel>
|
||||
</asp:Panel>
|
||||
|
||||
<asp:Panel ID="result" Runat="server" Visible="False">
|
||||
<asp:Literal ID="resultText" runat=server></asp:Literal>
|
||||
</asp:Panel>
|
||||
167
umbraco/presentation/install/steps/renaming.ascx.cs
Normal file
167
umbraco/presentation/install/steps/renaming.ascx.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using umbraco.IO;
|
||||
|
||||
namespace umbraco.presentation.install.steps
|
||||
{
|
||||
public partial class renaming : System.Web.UI.UserControl
|
||||
{
|
||||
private string _oldAccessFilePath = IO.IOHelper.MapPath(IO.SystemDirectories.Data + "/access.xml");
|
||||
private bool _changesNeeded = false;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// check xslt extensions
|
||||
identifyResult.Text += checkExtensionPaths("xsltExtensions.config", "XSLT Extension");
|
||||
|
||||
// check rest extensions
|
||||
identifyResult.Text += checkExtensionPaths("restExtensions.config", "REST Extension");
|
||||
|
||||
// check access.xml file
|
||||
identifyResult.Text += checkAccessFile();
|
||||
|
||||
if (_changesNeeded)
|
||||
{
|
||||
changesNeeded.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
noChangedNeeded.Visible = true;
|
||||
changesNeeded.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private string checkAccessFile()
|
||||
{
|
||||
if (oldAccessFileExist())
|
||||
{
|
||||
_changesNeeded = true;
|
||||
return "<li>Access.xml found. Needs to be renamed to access.config</li>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<li>Public Access file is all good. No changes needed</li>";
|
||||
}
|
||||
}
|
||||
|
||||
private bool oldAccessFileExist()
|
||||
{
|
||||
return File.Exists(_oldAccessFilePath);
|
||||
}
|
||||
|
||||
private string checkExtensionPaths(string filename, string extensionName)
|
||||
{
|
||||
string tempResult = "";
|
||||
foreach (XmlNode ext in GetExtensions(filename, "ext"))
|
||||
{
|
||||
if (ext.Attributes.GetNamedItem("assembly") != null &&
|
||||
ext.Attributes.GetNamedItem("assembly").Value.StartsWith("/bin/"))
|
||||
{
|
||||
tempResult += String.Format("<li>{0} with Alias '{1}' has assembly reference that contains /bin/. That part needs to be removed</li>",
|
||||
extensionName,
|
||||
ext.Attributes.GetNamedItem("alias").Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(tempResult))
|
||||
{
|
||||
tempResult = String.Format("<li>{0}s are all good. No changes needed</li>", extensionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_changesNeeded = true;
|
||||
}
|
||||
|
||||
return tempResult;
|
||||
}
|
||||
|
||||
private void updateExtensionPaths(string filename)
|
||||
{
|
||||
filename = IOHelper.MapPath(SystemDirectories.Config + "/" + filename);
|
||||
XmlDocument xsltExt = new XmlDocument();
|
||||
xsltExt.Load(filename);
|
||||
|
||||
foreach (XmlNode ext in xsltExt.SelectNodes("//ext"))
|
||||
{
|
||||
if (ext.Attributes.GetNamedItem("assembly") != null &&
|
||||
ext.Attributes.GetNamedItem("assembly").Value.StartsWith("/bin/"))
|
||||
{
|
||||
ext.Attributes.GetNamedItem("assembly").Value =
|
||||
ext.Attributes.GetNamedItem("assembly").Value.Substring(5);
|
||||
}
|
||||
}
|
||||
|
||||
xsltExt.Save(filename);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void updateChanges_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool succes = true;
|
||||
string progressText = "";
|
||||
|
||||
// rename access file
|
||||
if (oldAccessFileExist())
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Move(_oldAccessFilePath, IO.IOHelper.MapPath(IO.SystemFiles.AccessXml));
|
||||
progressText += String.Format("<li>Public Access file renamed</li>");
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
progressText += String.Format("<li>Error renaming access file: {0}</li>", ee.ToString());
|
||||
succes = false;
|
||||
}
|
||||
}
|
||||
|
||||
// update rest exts
|
||||
try
|
||||
{
|
||||
updateExtensionPaths("restExtensions.config");
|
||||
progressText += "<li>restExtensions.config ensured.</li>";
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
progressText += String.Format("<li>Error updating restExtensions.config: {0}</li>", ee.ToString());
|
||||
succes = false;
|
||||
}
|
||||
|
||||
// update xslt exts
|
||||
try
|
||||
{
|
||||
updateExtensionPaths("xsltExtensions.config");
|
||||
progressText += "<li>xsltExtensions.config ensured.</li>";
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
progressText += String.Format("<li>Error updating xsltExtensions.config: {0}</li>", ee.ToString());
|
||||
succes = false;
|
||||
}
|
||||
|
||||
string resultClass = succes ? "success" : "error";
|
||||
resultText.Text = String.Format("<div class=\"{0}\"><p>{1}</p></div>",
|
||||
resultClass,
|
||||
progressText);
|
||||
result.Visible = true;
|
||||
init.Visible = false;
|
||||
}
|
||||
|
||||
private XmlNodeList GetExtensions(string filename, string elementName)
|
||||
{
|
||||
|
||||
// Load the XSLT extensions configuration
|
||||
XmlDocument xsltExt = new XmlDocument();
|
||||
xsltExt.Load(IOHelper.MapPath(SystemDirectories.Config + "/" + filename));
|
||||
|
||||
return xsltExt.SelectNodes("//" + elementName);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
umbraco/presentation/install/steps/renaming.ascx.designer.cs
generated
Normal file
78
umbraco/presentation/install/steps/renaming.ascx.designer.cs
generated
Normal file
@@ -0,0 +1,78 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace umbraco.presentation.install.steps {
|
||||
|
||||
|
||||
public partial class renaming {
|
||||
|
||||
/// <summary>
|
||||
/// init control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel init;
|
||||
|
||||
/// <summary>
|
||||
/// noChangedNeeded control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel noChangedNeeded;
|
||||
|
||||
/// <summary>
|
||||
/// changesNeeded control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel changesNeeded;
|
||||
|
||||
/// <summary>
|
||||
/// identifyResult control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal identifyResult;
|
||||
|
||||
/// <summary>
|
||||
/// updateChanges control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button updateChanges;
|
||||
|
||||
/// <summary>
|
||||
/// result control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel result;
|
||||
|
||||
/// <summary>
|
||||
/// resultText control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal resultText;
|
||||
}
|
||||
}
|
||||
@@ -267,6 +267,13 @@
|
||||
<Compile Include="install\steps\license.ascx.designer.cs">
|
||||
<DependentUpon>license.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="install\steps\renaming.ascx.cs">
|
||||
<DependentUpon>renaming.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="install\steps\renaming.ascx.designer.cs">
|
||||
<DependentUpon>renaming.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="install\steps\theend.ascx.cs">
|
||||
<DependentUpon>theend.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -1497,6 +1504,7 @@
|
||||
<Content Include="config\splashes\booting.aspx" />
|
||||
<Content Include="config\splashes\noNodes.aspx" />
|
||||
<Content Include="config\splashes\worker.png" />
|
||||
<Content Include="install\steps\renaming.ascx" />
|
||||
<Content Include="install\Title.ascx" />
|
||||
<Content Include="web.config.Az-VAIO.xslt" />
|
||||
<Content Include="umbraco\endPreview.aspx" />
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace umbraco.presentation.umbracobase
|
||||
{
|
||||
XmlNode extNode = baseDoc.SelectSingleNode("/RestExtensions/ext [@alias='" + extensionAlias + "']");
|
||||
string asml = extNode.Attributes["assembly"].Value;
|
||||
string assemblyPath = IOHelper.MapPath((SystemDirectories.Root + "/" + asml.TrimStart('/') + ".dll"));
|
||||
string assemblyPath = IOHelper.MapPath(string.Format("{0}/{1}.dll", SystemDirectories.Bin, asml.TrimStart('/')));
|
||||
Assembly returnAssembly = System.Reflection.Assembly.LoadFrom(assemblyPath);
|
||||
|
||||
string returnTypeName = extNode.Attributes["type"].Value;
|
||||
|
||||
Reference in New Issue
Block a user