# API Product Role Access - default value

**URL:** <https://discuss.google.dev/t/api-product-role-access-default-value/16920>\
**Category:** Apigee\
**Tags:** developer-portal\
**Created:** [August 29, 2017, 5:00pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920 "2017-08-29T17:00:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [August 29, 2017, 5:00pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/1 "2017-08-29T17:00:11Z")

</div>

We are using the **DevConnect Limit API Product by Role** module in the Hosted Drupal developer portal in order to control access to API Products based on developer role. Currently, when a new Product is created, it gets set to “All logged-in developers” by default in **API Product Role Access**. is there a way to change the default to be only the “internal” developers? The majority of our APIs will be internal only and I’d prefer not to have them inadvertently exposed publicly if someone forgets to change this setting in the Dev Portal after creating a new product.

Thanks!

Mike:o

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [August 29, 2017, 8:28pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/2 "2017-08-29T20:28:54Z")

</div>

Hmm, looking at the code for this module, the default behavior you described is “hard coded” into the module code.

```auto
    if ($product_roles === FALSE) {
      // If product roles variable is not set, then set default of all logged
      // in developers having access.
      $product_roles = array(DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID);
    }
    else {
      // Variable was found, explode it.
      $product_roles = explode(',', $product_roles);
    }

```

This means… if an administrator hasn’t fiddled with the checkboxes for the roles, then “all authenticated users” (all logged-in developers) will have access.

I think your request is a reasonable one, though. It ought to be possible for an admin to specify the default access for any new product. It shouldn’t be hard to do.

Let me look into it a little more…

#### Edit

ok, I’ve produced a module that implements the same RBAC access for API Products, and also allows you to specify the default set of roles that will be able to see any new API Product. [Find it here](https://github.com/DinoChiesa/Edge-DevPortal-ApiProducts-Access-Extended). Give it a try and see if it works for you.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [August 30, 2017, 5:58pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/3 "2017-08-30T17:58:10Z")

</div>

[@Anil Sagar](https://community.apigee.com/users/368/asagarapigeecom.html) - you may want to be aware. Also maybe [@gkoli@apigee.com](https://community.apigee.com/users/1071/gkoli.html) .

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [September 1, 2017, 7:42pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/4 "2017-09-01T19:42:39Z")

</div>

Thanks Dino!

We’re working on getting this installed into our Test portal for testing and will get back to you with results.

---

<div class="post-metadata">

**Author:** ![anilsr](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@anilsr](https://discuss.google.dev/u/anilsr)\
**Post date:** [September 5, 2017, 5:14pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/5 "2017-09-05T17:14:38Z")

</div>

[@Dino](https://community.apigee.com/users/803/dchiesa.html) , Yes, I came across same question when ever i have used / asked to use above module. [@Chris Novak](https://community.apigee.com/users/123/cnovakapigeecom.html) , How can we fix same ? We would love to submit a pull request. Any help is appreciated regarding same.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [September 8, 2017, 9:31pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/6 "2017-09-08T21:31:02Z")

</div>

@Dino - We’ve installed the extended version of the module to our “dev” portal for testing and it seems to work well. Is this something that might find its way into the standard module, or should I consider deploying it to higher environments?

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 11, 2017, 9:27pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/7 "2017-10-11T21:27:41Z")

</div>

Hi Mike - sorry about the delay in responding. For now this is not included into the standard devportal distribution. You can use it anyway, just check the disclaimers in the README.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 12, 2017, 12:45pm UTC](https://discuss.google.dev/t/api-product-role-access-default-value/16920/8 "2017-10-12T12:45:19Z")

</div>

Thanks, we do have it deployed to our LIVE portal now. Hopefully at some point this will find its way into the standard module and we can convert back. In the mean time, it’s working well.
