apigee / apigee-devportal-kickstart-drupal

A fast demo and starting point for Apigee Developer Portals for Drupal
https://www.drupal.org/project/apigee_devportal_kickstart
GNU General Public License v2.0
26 stars 34 forks source link

Needed to Provide "Add API Doc" option to the Authenticated user or specific User #396

Closed pradeepgorle13 closed 3 years ago

pradeepgorle13 commented 4 years ago

Hi Team,

The Requirement is as follows:

image

image

  1. Then I added the API Doc related access to that role and saved it

image

  1. Then add that role (MyRole) to the user and saved it.

image

image

  1. Then, I logged into it as a federated user using Ping

image

  1. I didn't see any place where i can publish the API for that user

image

Please let me know if i have missed any steps or this is what i have gone through the roles and had a basic understanding of it.

Thanks., PRadeep

kiranjyoth commented 4 years ago

@pradeepgorle13 Can you access /admin/content/apis page using this user role ? If so, you have to set a few more permissions. image image Apart from these, you may have to check permissions on taxonomy, media, etc. based on your configuration. Thanks

kiranjyoth commented 4 years ago

@pradeepgorle13 You may have to add access to 'content overview page'. If you don't want to give access here, you can add API docs from here -- '/admin/content/api/add' (for API Catalog 2.1 ) ' node/add/apidoc ' (for API catalog 2.2) image

pradeepgorle13 commented 4 years ago

@pradeepgorle13 You may have to add access to 'content overview page'. If you don't want to give access here, you can add API docs from here -- '/admin/content/api/add' (for API Catalog 2.1 ) ' node/add/apidoc ' (for API catalog 2.2) image

Hi Kiran,

I added as you mentioned previously

When i selected the "Administer API Catalog", I am able to see the "Add API doc". But it is givving access to Edit/delete other API's. image

Also the Content Tab and the content info are being displayed image

But when i disabled the "Administer API Catalog" and enable the create New API Docs as shown below

image

I am unable to see the add API doc anymore but only content. image

As you already mentioned that when i used '/admin/content/api/add' it is enabled to add the API Doc.

But the requirement was to get the user to add the API Doc when they go to Content>add API Doc and without the display of content and enabling that particular user to add his OAS Document and edit it (Not allowing him to change/delete the other OAS docs).

Sorry for the long explanation but wanted to throw out what i have tried to do.

Thanks., Pradeep

kiranjyoth commented 4 years ago

Hello Pradeep,

I have setup a new instance with the configuration and requirement you described, and I can confirm that without enabling Administer API catalog permission, API catalog is not accessible to a user, even if the role is configured to add API docs. This seems to be a bug with the module in permissions and role matrix.

As Apigee API Catalog module is now updated to version 8.2.2, it's best to upgrade now and configure these permissions. The new version for API catalog also provides much more flexibility around search, node and form display. This being a content entity it will now inherit all features that other modules provide without having to customize your instance.

Thanks

pradeepgorle13 commented 4 years ago

Hello Pradeep,

I have setup a new instance with the configuration and requirement you described, and I can confirm that without enabling Administer API catalog permission, API catalog is not accessible to a user, even if the role is configured to add API docs. This seems to be a bug with the module in permissions and role matrix.

As Apigee API Catalog module is now updated to version 8.2.2, it's best to upgrade now and configure these permissions. The new version for API catalog also provides much more flexibility around search, node and form display. This being a content entity it will now inherit all features that other modules provide without having to customize your instance.

Thanks

Great.. Thanks for the Information. May I know - how i can update the latest version of the APIGEE API Catalog module. Please note that we have a Firewall which doesn't enable us to upgrade through portal/through internet. Is there a way where i can download and them upgrade it on the boxes. And the locations where i can copy those under /var/www/devportal/ folder.

kiranjyoth commented 4 years ago

@pradeepgorle13 here is the download link https://www.drupal.org/project/apigee_api_catalog/releases/8.x-2.2 Recommended installation is using composer.

Our approach for working within a firewall is to download the updated module locally, commit to the repo and deploy it on the server using CI. But if thats not an option, you may download the zip/tar file and unzip it, replace the older one with new version.

Once you do this, you will have to run drush updb for performing schema updates. Backups and lower environments are highly recommended, as this may have breaking changes.

The update from 8.x-1.x to 8.x-2.x will try to recreate any custom fields that were added to the API Doc custom entity onto a new "API Doc" node bundle, migrate data, and delete all API Doc custom entities and definitions. It is highly recommended to test on a development environment before running it in production. It is necessary to run database updates for this release.

Thanks

pradeepgorle13 commented 4 years ago

@kiranjyoth Thanks for the suggestion will go through the upgrade process and will let you know. So i am assuming that 8.x-2.2 version is a stable version

kiranjyoth commented 4 years ago

Correct, 8x.2.2 is the latest stable one release July 14th and tagged as recommended by the maintainer.

arunz6161 commented 4 years ago

To do: Document upgrade instructions for users behind firewall.

pradeepgorle13 commented 4 years ago

Correct, 8x.2.2 is the latest stable one release July 14th and tagged as recommended by the maintainer.

Will try and let you know.. Thanks @kiranjyoth

pradeepgorle13 commented 4 years ago

drush updb

@kiranjyoth I just downloaded the Zip folder and extracted it. I copied the apigee_api_catalog module and restarted the server. Then ap per your instruction I did the "drush updb". Please find the screenshot below image

Then I restarted the server But I am getting the following error image

Can you please suggest me the way forward. ,

kiranjyoth commented 4 years ago

@pradeepgorle13 looks like your install is not able to find the updated module. And from your screenshot I see no pending updates, which means the module is not updated. So I decided to attempt this on an older instance this weekend as I had some time and seemed like a fun challenge. I'm attaching a video of the upgrade attempt I did here. I will write a blog post about this sometime next week in more details.

Apigee Kickstart - API Catalog Upgrade

Watch it here https://youtu.be/FZIjcpQOgIU

This leads to the question on how to upgrade if you are behind firewall in your case. We can simply run composer update and download packages locally, commit it to git repository and deploy on server. Then you can run database updates and perform other actions needed. As @arunz6161 identified, we should document these steps. I will work on finding if we can find a better way to automate this here . https://github.com/apigee/devportal-kickstart-drupal-ansible-installer

pradeepgorle13 commented 4 years ago

@pradeepgorle13 looks like your install is not able to find the updated module. And from your screenshot I see no pending updates, which means the module is not updated. So I decided to attempt this on an older instance this weekend as I had some time and seemed like a fun challenge. I'm attaching a video of the upgrade attempt I did here. I will write a blog post about this sometime next week in more details.

Apigee Kickstart - API Catalog Upgrade

Watch it here https://youtu.be/FZIjcpQOgIU

This leads to the question on how to upgrade if you are behind firewall in your case. We can simply run composer update and download packages locally, commit it to git repository and deploy on server. Then you can run database updates and perform other actions needed. As @arunz6161 identified, we should document these steps. I will work on finding if we can find a better way to automate this here . https://github.com/apigee/devportal-kickstart-drupal-ansible-installer

@kiranjyoth Thanks for the response. It was very helpful. So I have asked my firewall team to open the network for the drupal site for a Day. Then as per the instruction in the Drupal site https://www.drupal.org/project/apigee_api_catalog/releases/8.x-2.2 I used the command image

Just got little bit further now image

Any suggestions. This is a Dev environment

kiranjyoth commented 4 years ago

@pradeepgorle13 great, if its dev and you have backed up, please run composer update. or if you want to just focus on updates for kickstart use composer update drupal/apigee_devportal_kickstart. API catalog 2.2 is available only for kickstart 1.7 and hence the requirement lock.

pradeepgorle13 commented 4 years ago

@pradeepgorle13 great, if its dev and you have backed up, please run composer update. or if you want to just focus on updates for kickstart use composer require drupal/apigee_devportal_kickstart. API catalog 2.2 is available only for kickstart 1.7 and hence the requirement lock.

@kiranjyoth Thanks for the response updated the apigee kick start as well as the catalog image

Then ran the updb too image

Then i restarted the server.

Then I tried to see which versions are there in the updates. Kickstart has got updated to 1.17 and catalog still shows 1.2(is this 2.2 ???) because it used to show 1.1(screen shot attached). image Before update image

But i am not seeing the "Apigee API Catalog" section under permissions image

kiranjyoth commented 4 years ago

@pradeepgorle13 seems like the catalog is not updated. Check your composer file at web/profiles/contrib/apigee_devportal_kickstart/composer.json . The following is mine. If it easier for a quick call, please use this and chat. https://drift.me/stratus-support/

"require": {
    "cweagans/composer-patches": "^1.6.5",
    "drupal/admin_toolbar": "^2.0",
    "drupal/adminimal_admin_toolbar": "^1.9",
    "drupal/apigee_api_catalog": "^2.2",
    "drupal/apigee_edge": "^1.10",
    "drupal/better_exposed_filters": "^3.0@alpha",
    "drupal/default_content": "^1.0@alpha",
    "drupal/email_registration": "^1.0@RC",
    "drupal/fontawesome": "^2.12",
    "drupal/paragraphs": "^1.6",
    "drupal/pathauto": "^1.6",
    "drupal/radix": "^4.8"
},
pradeepgorle13 commented 4 years ago

@kiranjyoth you were correct. It is still pointing to 1.0. Please see the screenshot below image Will connect with you tomorrow through the chat link you have sent

pradeepgorle13 commented 4 years ago

@kiranjyoth @cnovak @earth2marsh Thanks Kiran for spending more than two hours and guiding me through the issue. Really appreciate your efforts in getting this issue resolved.

Thanks., Pradeep

cnovak commented 4 years ago

Thank you @kiranjyoth for giving such great help!

cnovak commented 3 years ago

I will close this issue, but please comment if there is anything left to do.