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

Forums / General Discussions / Disable Set as Homepage

Disable Set as Homepage

7 posts, 0 answered
  1. Arjan
    Arjan avatar
    5 posts
    Registered:
    09 Jun 2006
    17 Nov 2014
    Link to this post

    Hi,

    I've read a lot of posts concerning this issue, but I can't seem to find the answer. I want to disable the 'Set as homepage' option from the Action menu. Some users can create/modify pages in a section of the web site, including the properties. They can't change properties of the current home page. But they CAN set one of their pages as home page. Therefore changing the properties of the Home page. How can I prevent this?

    ps. I'm using SF 7.2.

    Thanks in advance,
    Arjan Vermunt

  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    20 Nov 2014
    Link to this post
    Hello Arjan,

    Yes, this is a known issue described here: Ability to Change Homepage should be able to be restricted

    We are planning in some of our future releases to perform a complete code refactoring of Sitefinity`s permissions module to provide more flexibility and cover scenarios as your current one.

    Kind regards,
    Vassil Vassilev
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    20 Nov 2014
    Link to this post
    Just a quick follow up: your scenario can be achieved using custom code rather easily by simply extending PageService (I have attached the necessary files to achieve this).

    The steps required are:
    • include PageServiceExtended.cs in your solution
    • include PageServiceExtended.svc in ~\Sitefinity\Services\Pages\PageServiceExtended.svc
    • build the solution
    • go to Administration >> Settings >> Advanced >> ContentView >> Controls >> FrontendPagesListView and under  WebServiceBaseUrl type the new one: ~/Sitefinity/Services/Pages/PagesServiceExtended.svc/
    • restart the application

    When someone changes the home page is called:
    public void SetHomePage(string pageId)
    {
        pageservice.SetHomePage(pageId);
    }

    What you can do is to check if the current user belongs to a restricted role and if he does, to skip the line "pageservice.SetHomePage(pageId)" method.

    Hope this helps.

    Regards,
    Vassil Vassilev
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  4. Arjan
    Arjan avatar
    5 posts
    Registered:
    09 Jun 2006
    20 Nov 2014
    Link to this post

    Hi Vassil,

    The solution you supplied works like a charm.

    Can the same be done for editing Lists/List Items. I have a support call concerning ownership of Lists. I want to prevent users, other than the owner of the List, editing List Items in that List. Can I create a custom service for editing List Items in Lists.

    Thanks,
    Arjan

  5. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    21 Nov 2014
    Link to this post
    Hello Arjan,

    I am glad this helped.

    You can modifying the lists following the approach with the pages- easiest solution is to modify the service not to return the lists, for which the user does not an owner (maybe there should be additional logic for admins to see all lists).

    This can be achieved as follows:
    • add ListServiceExtended.svc in ~\Sitefinity\Services\Pages\ListServiceExtended.svc
    • add ListServiceExtended.cs in your project
    • build it
    • go to Administration >> Settings >> Advanced >> ContentView >> Controls >> ListsBackend >> Views >> ListsBackendList  and under  WebServiceBaseUrl type the new one: ~/Sitefinity/Services/Pages/ListServiceExtended.svc/
    • restart the application

    The trick is to add custom logic in here:
    public override IEnumerable<ListViewModel> GetViewModelList(IEnumerable<List> contentList, ContentDataProviderBase dataProvider)
    {
        var viewModels = listservice.GetViewModelList(contentList, dataProvider);
        return viewModels;
    }

    You can filter viewModels before the service return it as you need - for instance you can remove any lists that the user should not modify and they will not be displayed in the grid.

    Hope this information helps.


    Regards, Vassil Vassilev
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  6. Arjan
    Arjan avatar
    5 posts
    Registered:
    09 Jun 2006
    23 Nov 2014
    Link to this post

    Hi Vassil,

    I gave your suggestion a go and was able to override the default behavior of fetching the lists. How can I determine the id of the owner. The Lists object has an Owner property of type string, but that seems to be a concatenation of the First and Last name. Which api should I use to compare the current user against the owner of the list?

    Thnx,
    Arjan

  7. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    25 Nov 2014
    Link to this post
    Hello,

    I could suggest the following approach:

    public override IEnumerable<ListViewModel> GetViewModelList(IEnumerable<List> contentList, ContentDataProviderBase dataProvider)
    {
        var identity = ClaimsManager.GetCurrentIdentity();
        var UserId = identity.UserId;
         
        var viewModels = listservice.GetViewModelList(contentList, dataProvider).Where(vm => vm.ContentItem.Owner == UserId).ToList();
        return viewModels;
    }

    Keep in mind that you need to add additional check for admin users.

    Hope this helps.

    Regards,
    Vassil Vassilev
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
7 posts, 0 answered