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

Azure AD Delta Sync for Drupal

2.0.0 2025-02-03 09:53 UTC

This package is auto-updated.

Last update: 2025-02-17 07:42:06 UTC


README

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, azure_ad_delta_sync.user_manager (Drupal\azure_ad_delta_sync\UserManager) and azure_ad_delta_sync.controller (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

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).