private void PerformCopy(N2.ContentItem newItem) { EnsureAuthorization(Permission.Write); EnsureAuthorization(Selection.MemorizedItem, Permission.Read); var persister = Engine.Persister; newItem = persister.Copy(newItem, Selection.SelectedItem); var security = Engine.SecurityManager; if (security.GetPermissions(User, newItem) != security.GetPermissions(User, Selection.SelectedItem)) { security.CopyPermissions(newItem.Parent, newItem); persister.Repository.Save(newItem); } if (newItem.IsPublished() && !security.IsAuthorized(User, newItem, Permission.Publish)) { newItem.Published = null; persister.Repository.Save(newItem); } Refresh(newItem, ToolbarArea.Both); }
private void PerformCopy(N2.ContentItem newItem) { EnsureAuthorization(Permission.Write); EnsureAuthorization(Selection.MemorizedItem, Permission.Read); var persister = Engine.Persister; newItem = persister.Copy(newItem, Selection.SelectedItem); var security = Engine.SecurityManager; if (security.GetPermissions(User, newItem) != security.GetPermissions(User, Selection.SelectedItem)) { security.CopyPermissions(newItem.Parent, newItem); persister.Repository.SaveOrUpdate(newItem); } if (newItem.IsPublished() && !security.IsAuthorized(User, newItem, Permission.Publish)) { newItem.Published = null; persister.Repository.SaveOrUpdate(newItem); } Engine.AddActivity(new ManagementActivity { Operation = "Copy", PerformedBy = User.Identity.Name, Path = newItem.Path, ID = newItem.ID }); Refresh(newItem, ToolbarArea.Both); }