More in this section

Forums / Developing with Sitefinity / Restricting/customising categories

Restricting/customising categories

6 posts, 0 answered
  1. Terrence
    Terrence avatar
    23 posts
    Registered:
    23 Mar 2009
    20 May 2009
    Link to this post

    Hi there,

    I have a question pertaining to categories.

    I tried searching online for a way to restrict the categories which the content contributors can create their pages in, but have turned up no results.

    What I want to achieve is that when I log in as different users, the categories available to them where they are able to create new content items to is limited, i.e. HR user to HR categories, IT user to IT categories and so on.

    Why I need this is because I will be displaying multiple categories of content in the same content page, and hence would appreciate such a control.

    Thanks in advance,
    Terrence

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 May 2009
    Link to this post
    Hi Terrence,

    The problem here is more complicated that it seems to be. There are many places that you can create or manage categories - when you create and edit IContent item, Adding categories through Admin UI using CategoriesView, managing Categories controls that exist in your toolbox. Also it will be difficult to create a key identifire to associate your categories with a Role.

    However if you want only to show certain categoris you should map the external templates for the desired module ( for instance  - NewsItemNew and NewsItemEdit templates)
    Then on Page_Load find the control with ID="Category" using recursion. After you find the control you can check the user role and deside whether to show ContentCategoriesFiled, but AddCategory method is private - so you cannot get the actual population of the drop down.

    For the command panel - where all categories are created you could create a custom view and override CategoriesTreeView_NodeDataBound method where you can get all categories, but you cannot specify which of them will be shown. You should get the node text  of the desired categories that will be visible and hide the other ones.

    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.
  3. Terrence
    Terrence avatar
    23 posts
    Registered:
    23 Mar 2009
    20 May 2009
    Link to this post
    Hi Ivan

    Thank you for your reply.

    Do you have a code sample that I can refer to please? I apologise but I do not fully comprehend what you have so vivdly described to me.

    Thank you so much.

    Best regards
    Terrence
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 May 2009
    Link to this post
    Hi Terrence,

    The content Categories are metakeys. There is no implementation for  showing categories based on any role, which means you can only hide the controls from the templates.

    Regards,
    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. Terrence
    Terrence avatar
    23 posts
    Registered:
    23 Mar 2009
    20 May 2009
    Link to this post
    My apologies Ivan, but I do not understand what you mean.

    Could you elaborate further please?

    Thank you in advance.

    Best regards
    Terrence
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 May 2009
    Link to this post
    Hello Terrence,

    Your requirement is not achvable - there is no method that will allow you to separate the categories that are loaded by ContentCategoriesField control which is used when creating or editing content items. Also its AddCategory method is private and cannot be overriden

    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.
Register for webinar
6 posts, 0 answered