Apologies if this is a oversight on my behalf or reported previously - I could not find anything related.

Everything works as expected when no permissions limitations are applied. When I choose only specific roles to be able to use a facet (e.g. admin/config/search/facetapi/apachesolr%40solr/block/bundle/dependencies) and the admin user (uid 1) does not have any of these roles, then the facet is not displayed for the admin user. If empty text has been defined for the facet (e.g. admin/config/search/facetapi/apachesolr%40solr/block/bundle/edit) then the facet block appears with the empty text. If the allowed facet roles are assigned to the admin user, then facets appear as expected.

Shouldn't the admin user be allowed to view the facets regardless of limitations in the facet dependencies page?

Thanks

Comments

nick_vh’s picture

Project: Apache Solr Search » Facet API
Version: 7.x-1.0-beta13 » 7.x-1.x-dev

I suppose this is an issue for Facetapi?

cpliakas’s picture

Issue tags: +low hanging fruit

Hi natuk.

Thanks for posting. User 1 is a special case, and to be consistent with Drupal I think you are correct in that this user should always pass the role dependency. I am putting this on the "low hanging fruit" list as it would be an easy fix. Would love to get a patch for this since it would be great to get the 20th code contributor. Specifically, an if (1 == $user->uid) could be wrapped around lines 18 to 21 of the FacetapiDependencyRole::execute() method which would essentially return NULL for user 1. Note that we don't want to return TRUE so we can give other dependencies the chance to either pass or fail.

Based on your description, there is also another bug in the code's logic that I cross posted at #1395224: Empty facet behavior plugin is executed on facets that fail dependencies. As the title suggests, the empty facet behavior plugin shouldn't be executed for a facet that fails its dependencies.

Thanks,
Chris

cpliakas’s picture

Title: Facet blocks do not show for admin user » User 1 does not automatically pass the role dependency which is inconsistent with other areas of Drupal

Changing title to be more reflective of the bug.

cpliakas’s picture

Status: Active » Fixed

Nobody seemed to want to take this. Committed at http://drupalcode.org/project/facetapi.git/commit/acc830f.

natuk’s picture

Sorry, too scared. But thanks.

Automatically closed -- issue fixed for 2 weeks with no activity.