Set as Homepage permissions?
I came across an interesting issue. We have a number of users delegated to certain pages on our sites. As far as editing and creating, setting permissions in specific group pages works fine. However, I came to my site to find the wrong page showing at the root. Turns out one of my users set their page as the homepage of the entire site. Is there anyway to stop this? Obviously I'll tell everyone not to do it but ideally I wouldn't give them the opportunity too. This is extremely disruptive to the site.
Hello,
Set as homepage appears in the actions menu for each normal page. To prevent users to do use page properties edit permissions for all pages and remove the users role (for example editors ) from Modify Properties of this page and child pages and delete this page and its child pages. Without those two permissions the set as homepage button will not appear.
There is no separate permission for set as homepage, but permissions are grouped into groups. Page properties includes all properties from the actions dropdown for each page.
Thanks. However this still doesn't satisfy what I need. I segregate group pages for each department and give them control in there. I don't think it is appropriate to group a setting such as "set as homepage" that affects the entire site with other properties that are so granular. Let me put it this way. I would consider "set as homepage" a property of the entire website rather than a property of an individual page. I suppose the only way to fix this is to make my own page module or get enough votes in the PITS?
Hi,
Set as homepage is a page property as all other under Actions dropdown and all page properties have one permission over them. Another solution is to set the startup page in Global.asax so when the url of the site is requested no matter which page is set as homepage the fist opened page will be the one specified on Application_Start.
Regards,Thanks for the application_start idea. I will at least implement that as a safe guard.
Sorry to resurrect this post, but is there an example of how to program this in global.asax?
Thanks
Jonathan
Hi,
To set a page as homepage trough sitefinity API refer to this documentation for reference and use this API to assign page as home page.
var fluent =App.WorkWith();
var pageId = fluent.Pages().Where(pN => pN.Title ==
"NewHomePage"
).Get().FirstOrDefault().Id;
fluent.Page(pageId).SetAsHomePage().SaveChanges();
Thanks Stanislav, that works.
I made 2 small code changes to 1) check for nulls and 2) only work with front end pages (otherwise I get an error trying to access back end pages:
private
static
void
ResetHomepage()
var fluent = App.WorkWith();
var pageNode = fluent
.Pages()
.LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
.Where(pN => pN.Title ==
"Home"
)
.Get()
.FirstOrDefault();
if
(pageNode !=
null
)
var pageId = pageNode.Id;
fluent.Page(pageId).SetAsHomePage().SaveChanges();
Another way to work around this issue is by going to Administration-> Backend Pages and editing the "Pages" page. Add a Java Script control with the below jQuery and set the "Where to include in HTML" property to "Where the widget is dropped":
$(document).ready(
function
()
$(
".sfSetHome"
).parent().hide();
);
It doesn't do away with the permissions to change the home page property, but it will at least hide the link to do it. Also, if you need to change the home page in the future, you can just remove the script block/change the home page/add the script block back which is still easier than modifying the code and rebuilding your project.
Alan
That is the best solution so far. Thanks for the idea! Years later it is still an issue!