Skip to content

itk-dev/azure-ad-delta-sync-drupal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure AD Delta Sync for Drupal

Drupal module for Azure AD Delta Sync.

Installation

composer require itk-dev/azure_ad_delta_sync
vendor/bin/drush pm:enable azure_ad_delta_sync

Go to /admin/config/azure_ad_delta_sync to set up the module.

You will probably want to add Azure api keys in settings.local.php, i.e.

# settings.local.php

$config['azure_ad_delta_sync.settings']['azure']['uri'] = '';
$config['azure_ad_delta_sync.settings']['azure']['security_key'] = '';
$config['azure_ad_delta_sync.settings']['azure']['client_secret'] = '';

Furthermore, you may want to install the Config Ignore module and ignore the azure_ad_delta_sync.settings config if committing config to a version control system.

Usage

A cron job should run the following command at regular intervals:

vendor/bin/drush azure_ad_delta_sync:run --force

Run vendor/bin/drush azure_ad_delta_sync:run --help for details on the command.

Development

For development you need a full Drupal project. See itk-dev/azure-ad-delta-sync-drupal-test for an example.

We use lazy services, aDrupal\azure_ad_delta_sync\UserManager and Drupal\azure_ad_delta_sync\Controller, which require generating proxy classes (cf. https://www.webomelette.com/lazy-loaded-services-drupal-8).

Run the following command to update the proxy classes:

./scripts/generate-proxy-classes

Automated tests

Requires a full Drupal installation with the azure_ad_delta_sync_drupal module in the web/modules/contrib folder.

(cd «DRUPAL_ROOT»/web; ./vendor/bin/phpunit modules/contrib/azure_ad_delta_sync_drupal/tests/src/Functional)

Coding standards

The code follows the Drupal Coding Standards (cf. phpcs.xml.dist) and can be checked by running

composer install
composer coding-standards-check

Use

composer coding-standards-apply

to automatically fix some coding standard violations.

Markdown files

docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint '**/*.md' --fix
docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint '**/*.md'

Code analysis

phpstan is used to perform static analysis of the code. Run the following script:

./scripts/code-analysis

Rector

Automatic code upgrades

./scripts/rector

GitHub Actions

We use GitHub Actions to check coding standards, perform code analysis and run automated tests whenever a pull request is made (cf. .github/workflows/pr.yaml).

Before making a pull request you can run the GitHub Actions locally to check for any problems:

Install act and run

act -P ubuntu-latest=shivammathur/node:focal pull_request

(cf. https://github.com/shivammathur/setup-php#local-testing-setup).