You could use a custom save event composer to not allow users to save any content on the homepage. You could just allow your email to save the homepage.
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Events;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
using Umbraco.Core.Services.Implement;
using Umbraco.Web;
using Umbraco.Web.Security;
namespace UmbracoBuild.Composers
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class SavingEventComposer : ComponentComposer<SavingEventComponent>
{ }
public class SavingEventComponent : IComponent
{
private readonly IUmbracoContextFactory _umbracoContextFactory;
public SavingEventComponent(IUmbracoContextFactory umbracoContextFactory)
{
_umbracoContextFactory = umbracoContextFactory;
}
public void Initialize()
{
ContentService.Saving += ContentService_Saving;
}
private void ContentService_Saving(IContentService sender, ContentSavingEventArgs e)
{
IUser currentUser = null;
foreach (var node in e.SavedEntities)
{
using (UmbracoContextReference umbracoContextReference = _umbracoContextFactory.EnsureUmbracoContext())
{
var userTicket = umbracoContextReference.UmbracoContext.HttpContext.GetUmbracoAuthTicket();
if (userTicket != null)
{
currentUser = Current.Services.UserService.GetByUsername(userTicket.Identity.Name);
}
//your homepage node
if (node.ContentType.Alias == "homePage" && node.Id > 0)
{
//only allow your username to save the homepage
if(currentUser.Username != "your_username_here")
{
e.Cancel = true;
e.CancelOperation(new EventMessage("Error", "You do not have the permissions to save this page.", EventMessageType.Error));
}
}
}
}
}
public void Terminate()
{
}
}
}
permissions - dont allow editing of homepage.
How do I stop users from editing the homepage. When I apply the browse permissions all subpages are also affected.
anybody??? please
The browse permission only allows the user to view the node (and its children), have you tried removing the Update permission?
Hi Welton the issue is its affecting all nodes - then I have to go to all children of home and add the update permission.
You could use a custom save event composer to not allow users to save any content on the homepage. You could just allow your email to save the homepage.
is working on a reply...