Restrict list of APIs

Hi! In the default Drupal 7 installation there is a menu option at the top called "APIs".

Clicking it you get a list of all available API products (API models in practise) - but I would like it to only contain the API products which the current user is allowed to know about.

To restrict visibility of API products during Dev App listings we use Drupal module DevConnect Limit API Product By Role.

And to restrict content we rely on Drupal Module Taxonomy Access Control Lite.

How do we modify the Drupal view which lists all API products to ONLY list the API products which the user should be allowed see based on role assignments?

Kind regards, Erik

3 7 386
7 REPLIES 7

There are several options, as always with Drupal.

Here's an article from Anil from last year, describing an approach he took to build a product catalog view. And I think this used RBAC to restrict the list. Have you seen this?

Thanks for the reply but the @Anil Sagar @ Google´s post doesn´t seem to address the kind of restriction that I´m looking for.

Guess one way would be to access the TAC lite module while forming the query filter. Have no clue how to do that though and the module, though used quite a lot, seems to lack a vibrant community. Please let me know if you´ve seen other potential solutions.

@Erik Andersson

Use the Content Access module. Apply the the access control on the SmartDocs Method content type.

Once you have the module turned on, you should find the settings at:

/admin/structure/types/manage/smart_method/access

Thanks for the suggestion but looking at the Content Access module home at the Drupal site, it seems not stable enough for production use, i.e the maintainer recommends a beta release. Thanks anyways!

With over 64000 reported users, you're actually pretty safe with the beta release here. The release types (alpha, beta, rc, point release) are solely at the maintainers discretion, and some are very conservative and may leave a module in beta for years.

Use current user's UID as a contexture filter, and use that id setup views relationship and then use the relationship see if you can find a way to set the views filter. Or via a reversed way to limit it to the current user with the uid.

Sorry but I´m not that good at Drupal. Please add some more details because at this point I don´t really know how test your suggestion.