You can, but you would have to setup a custom check using an ApplicationEventHandler.
An example would be something along the lines of below. It hooks in to the Saving event in the content service, and checks if the name has been changed on the saved entity.
public class ContentSavingEvents : ApplicationEventHandler
{
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ContentService.Saving += ContentService_Saving;
}
private void ContentService_Saving(IContentService sender, Umbraco.Core.Events.SaveEventArgs<Umbraco.Core.Models.IContent> e)
{
foreach (var savedItem in e.SavedEntities)
{
var currentPage = sender.GetById(savedItem.Id);
if (!currentPage.Name.Equals(savedItem.Name, StringComparison.InvariantCultureIgnoreCase))
{
//Check user roles here to check if have permission to edit node name
if(!userCanEdit){
e.Cancel = true;
e.Messages.Add(new EventMessage("Error", "Message", EventMessageType.Error));
}
}
}
}
Prevent user from edit node name
Hi everyone!
Is it possible to prevent some users (belonging to a specific group) from changing the node name (content and/or media)?
Thank you
S
You can, but you would have to setup a custom check using an ApplicationEventHandler.
An example would be something along the lines of below. It hooks in to the Saving event in the content service, and checks if the name has been changed on the saved entity.
Thank you Harrison!
Yeah, that's my current scenario, but I was thinking about something implemented on the client-side (sorry, I didn't give you info enough).
I'd like to make read-only the node name textbox, any suggestion?
Thank you again!
S
is working on a reply...