Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Restrict API Products sync to the Drupal based portal

Hello,

We have a scenario where we are connecting two developer portals to single Apigee Edge(public cloud). We have parent and child organizations, both organizations having common Apigee Edge. Here we would like to split the products based on the custom attributes. Developer portals are built in Drupal 9 using Apigee kickstart. I don't want to sync all the products to both dev portals. We would like to restrict the product sync from the Apigee Edge. I see Apigee Edge module is providing RBAC module but that doesn't help in our scenario. As a Drupal administrator I can see all the products in my portal.

Is there any way that we can restrict the product sync to the portal? Thanks in advance.

0 4 306
4 REPLIES 4

I wrote a drupal module a while ago to filter the products list based on environment. In other words, portal1 would get all the products that were available in prod, and portal2 would get products that were available in test. This module is here: https://github.com/DinoChiesa/Edge-DevPortal-Filter-ApiProducts

This might not be exactly what you want - filter by environment - but it's pretty close.  It's a filter.  More importantly though, I have not updated that module to work with Drupal9.  It won't work with Drupal 9.  But converting to Drupal 9 is pretty straightforward. You may be able to use this older module as a starting point to build your own filter to accomplish your goal. 

Let me add: ....  it's possible there is a module that works for Drupal 9 that does exactly what you want!  I haven't checked!  and also I am not aware of all the various current modules that are available. So please do check for more.

For Drupal 9 you can write a custom module which overwrites the hook_entity_type_access (sample code)

Thank you @dchiesa1 & @gitesh , One more thing can we apply same scenario at App level?  ex: I am a user with same email id in both portal1 and portal2. Whenever I creates app from portal1 it reflects in both portal1 and portal2. Same thing is happening in either way. Can we add some restriction while displaying/fetching apps in the portal? As I know we are fetching apps based on user email id and displaying it on Portal App landing page. Here we are internally using management APIs to fetch the apps from Apigee Edge.  Thanks in advance.

Yes, you can apply the same hook that Gitesh mentioned, to filter the list of Apps.