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

Forums / Security / Access permissions by News Categories

Access permissions by News Categories

9 posts, 0 answered
  1. Saumitra
    Saumitra avatar
    127 posts
    Registered:
    10 Mar 2009
    21 Jul 2009
    Link to this post
    Hi,

    I wanted to know whether I can assign permissions to a particular set of users to only certain news categories. For example, if I have Category A and Category B for news, I would want some of the admin users to approve / modify only Category B news. Is it possible ?

    We are using Sitefinity 3.6 Standard Edition.

    Thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Jul 2009
    Link to this post
    Hi Saumitra,

    The RadGrid in News Module - NewsItemsList view is client side bound which does not allow you to call UserManager class. There are two options.

    1. Hide edit and delete buttons for items that do not belong to a certain role.

         if (Telerik.Security.UserManager.IsCurrentUserInRole("userGroup")) 
            { 
                ClientTemplate cTemplae = FindControlRecursive(GridTemplates, "test"as ClientTemplate; 
                cTemplae.Visible = false
            } 

    Here you need to use recursion to find ClientTemplate  control. You should set ID of each ClientTemplate control.

    2. Create a custom view and bind it manually on the server. You can use ObjectDataSource. Then in your view you will be able to loop through all items and filter by category.

    The current implementation allows you to filter the items - for instance by Category using filterExpressionsAsSQL parameter of DataBindGrid function, but you cannot access the currently logged user.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    23 Jul 2009
    Link to this post
    Hi,

    Can you please specify in detail that how can we create custom control to filter newsitemlist and commentlist category wise.

    --Thanks
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Jul 2009
    Link to this post
    Hello shraddha,

    If you are talking for the backend you can pass the filter expression parameter as filterExpressionsAsSQL of DataBindGrid function

    function DataBindGrid(currentPageIndex, pageSize, sortExpressionsAsSQL, filterExpressionsAsSQL) { 
        var requiredMetaFields = ['Title''Author''Source''Publication_Date''Expiration_Date']; 
        var cultureInfoField = document.getElementById('<%= cultureInfoField.ClientID %>'); 
        Telerik.Cms.Engine.Services.ContentService.GetContentItems(currentPageIndex * pageSize, pageSize, 
        sortExpressionsAsSQL, "Category IN ('Test')", requiredMetaFields, cultureInfoField.value, dataProviderName, updateGrid, OnFailed 

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    23 Jul 2009
    Link to this post
    Hi,

    When I give filterExpressionsAsSQL as "Category IN ('Press Releases')" then page shows empty place holder.
    Where "Press Releases" is one of my news category which contains more than 15 news items.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Jul 2009
    Link to this post
    Hi shraddha,

    Try using the following syntax 'Category = "Test"'. This should filter the items.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. shraddha
    shraddha avatar
    87 posts
    Registered:
    18 May 2009
    24 Jul 2009
    Link to this post
    Hi Ivan,

    It Worked.. thanx.
    Now in news add/edit controls, I want to filter category dropdown values.
    I have total 10 news categories and among that for "Test" User Role(i.e. if logged user is belogs to role "Test"), 
    then I want display only 4 categories in dropdown.
    How can i achieve that..

    Thank you
  8. Nisha
    Nisha avatar
    17 posts
    Registered:
    17 Jun 2009
    24 Jul 2009
    Link to this post
    hi,
    I have used above filter expression, and its work fine.
    But this expression does not work for search functionality using  'Search Items by' drop down and search button.
    It always gives me the result of first expression.
    How can i handle search functionality ?
    Waiting for reply.

    Thank you,
    Nisha
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Jul 2009
    Link to this post
    Hi Nisha,

    The provided expression is valid only for the Grid binding. If you want to apply some kind of custom filtering you can create a custom view that inherits from NewsItemsList and override InitializeSearch(). Then create a new command for SearchButton(SearchButton.Command += this.SearchButton_Command) and add your filter.

    shraddha:

    Category dropdown is ContentCategoriesField control. First you need to map external templates - NewsItemEdit and NewsItemNew. Then create a custom control that inherits ContentCategoriesField, set layoutTemplatePath to an external template.
    The template is located under [ExternalTemplates]/Sitefinity/Admin/ControlTemplates/Generic_Content folder. As you will see the template use RadComboBox control that you can manage. Afterwards you need to override InitializeControls and access the RadComboBox.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
9 posts, 0 answered