polydigital / backdrop-civicrm-docker

0 stars 1 forks source link

create apikey from .env for admin user #28

Closed tabroughton closed 5 years ago

tabroughton commented 5 years ago

We need an apikey for the admin user so that we can make remote calls to cron, we'll also need this for rest api calls when doing further tests and examples etc.

.env will have a new variable ADMIN_API_KEY

and the value should contain some random key entered by the developer/engineer before running docker-compose

This environment var can then be used in other docker containers (And is written to the crm for the admin user).

Note: it's useful to make a key using something like echo -n myRandomString | md5sum

tabroughton commented 5 years ago

We can easily add the api_key to a contact in civicrm if we know the contact id.

The API key however needs to also be associated to a (cms) user who has the appropriate permissions to run whatever task.

The cms user on install is user 1 and the table that joins user to contact is called UFMatch which requires:

For now we will add the contact as the default organsiation so simple contact_id=1.

For future reference we will need to change this if issues arise and before we go to production so that we 1) create a new contact and add the key to that contact (the contact should be individual and possibly linked to the organisation though not that imporant, and in fact may link to a different org). 2) use the newly created contact id in the UFmatch create statement.

tabroughton commented 5 years ago

have created a future issue to capture what might be needed