+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Set as Homepage permissions?

Set as Homepage permissions?

10 posts, 0 answered
  1. cli
    cli avatar
    50 posts
    Registered:
    21 May 2007
    09 Feb 2012
    Link to this post
    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.
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    14 Feb 2012
    Link to this post
    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.

    Greetings,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. cli
    cli avatar
    50 posts
    Registered:
    21 May 2007
    14 Feb 2012
    Link to this post
    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?
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    16 Feb 2012
    Link to this post
    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,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. cli
    cli avatar
    50 posts
    Registered:
    21 May 2007
    16 Feb 2012
    Link to this post
    Thanks for the application_start idea.  I will at least implement that as a safe guard.
  6. Jonathan
    Jonathan avatar
    9 posts
    Registered:
    09 Apr 2013
    08 Nov 2013
    Link to this post
    Sorry to resurrect this post, but is there an example of how to program this in global.asax?

    Thanks

    Jonathan
  7. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    13 Nov 2013
    Link to this post
    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();

    Regards,
    Stanislav Velikov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Jonathan
    Jonathan avatar
    9 posts
    Registered:
    09 Apr 2013
    14 Nov 2013 in reply to Stanislav Velikov
    Link to this post
    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();
        }
    }

    Cheers

    Jonathan
  9. OregonTech
    OregonTech avatar
    9 posts
    Registered:
    08 Jan 2009
    20 Mar 2014 in reply to Jonathan
    Link to this post

    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

     

  10. cli
    cli avatar
    50 posts
    Registered:
    21 May 2007
    21 Mar 2014 in reply to OregonTech
    Link to this post

    That is the best solution so far.  Thanks for the idea!  Years later it is still an issue!

10 posts, 0 answered