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,
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:
When someone changes the home page is called:
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
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.
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:
The trick is to add custom logic in here:
IEnumerable<ListViewModel> GetViewModelList(IEnumerable<List> contentList, ContentDataProviderBase dataProvider)
var viewModels = listservice.GetViewModelList(contentList, dataProvider);
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
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?
var identity = ClaimsManager.GetCurrentIdentity();
var UserId = identity.UserId;
var viewModels = listservice.GetViewModelList(contentList, dataProvider).Where(vm => vm.ContentItem.Owner == UserId).ToList();