Child Categories not visible to guests even though permissions allow find/access/read



  • I have a forum with 2 levels of categories. When logged in as an admin all categories and sub-categories are visible, but when browsing as an anonymous guest, the sub-categories cannot be seen. NodeBB is v0.9.2.

    I've checked the permissions on the sub-categories and they are set as follows. I've also tried resetting and setting the permissions back but no difference:

    0_1467353814837_Screen Shot 2016-06-30 at 11.16.08 PM.png

    I checked the code and the children are definitely being filtered out due to permissions. If I comment out the following lines of code in /src/categories.js the sub-categories show.

    244 function (children, next) {
    245   privileges.categories.filterCids('find', children, uid, next);
    246 },
    

    I added the following to the UI to see if the .children array is empty and it is - "We have children" never shows to guests:

    <p><!-- IF ../children.length -->We have children<!-- ENDIF ../children.length --></p>
    

    Here's my full UI code. Nothing inside the second <ul> renders:

    <!-- IMPORT partials/breadcrumbs.tpl -->
    <h1 class="categories-title">[[pages:categories]]</h1>
    
    <ul class="home-category-list categories" itemscope itemtype="http://www.schema.org/ItemList">
    
    <!-- BEGIN categories -->
    
    	<h2 class="title top-level-category">
    		<!-- IMPORT partials/categories/link.tpl --><br />
    		<div class="description">
    		{../descriptionParsed}
    		</div>
    	</h2>
    
    	<p><!-- IF ../children.length -->We have children<!-- ENDIF ../children.length --></p>
    
    	<ul class="home-sub-category-list categories" itemscope itemtype="http://www.schema.org/ItemList">
    		<!-- BEGIN children -->
    		<!-- IMPORT partials/categories/item.tpl -->
    		<!-- END children -->
    	</ul>
    	<div class="clearfix divider"></div>
    <!-- END categories -->
    </ul>


  • @danielflippance

    Have a look at the following post. I do not know if this is precisely the same as your issue but it seems to be in the same family.

    @julian said in 'Category Privileges' does not seem to work:

    I can confirm that the "Access Topics" privilege is not functioning correctly, so will need to look into that.

    However, with "Create Topics" disabled, the "New Topic" button is not present, and the category itself is not present in the composer dropdown, so that privilege is working as intended.

    https://github.com/NodeBB/NodeBB/issues/4753

    Specifically:
    @julian said in 'Category Privileges' does not seem to work:

    Fixed in latest master, the labels were swapped, so "Access" was actually controlling "Create", and vice versa.


Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.