openeuropa / oe_authorisation
User authorisation features for the OpenEuropa project.
Installs: 1 169
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 17
Forks: 0
Open Issues: 4
Type:drupal-module
Requires
- php: ^7.1
- drupal/core: ^8.7
- openeuropa/syncope-php-client: dev-master
Requires (Dev)
- composer/installers: ^1.2
- drupal-composer/drupal-scaffold: ^2.2
- drupal/config_devel: ~1.2
- drupal/devel: ^1.2
- drupal/drupal-extension: ~4.0
- drush/drush: ^9
- nikic/php-parser: ~3.0
- openeuropa/behat-transformation-context: ~0.1
- openeuropa/code-review: ~1.0.0-beta2
- openeuropa/drupal-core-require-dev: ^8.7
- openeuropa/task-runner: ~1.0.0-beta5
This package is auto-updated.
Last update: 2024-11-16 22:58:37 UTC
README
The OpenEuropa Authorisation module offers default features related to user authorisation for the OpenEuropa project.
The module automatically disables the Roles/Permissions CRUD UI to guarantee that any configuration related with roles is not changeable via the UI. This functionality is not removed for uid 1.
The module provides the following user roles:
- Site Manager (general administrative permissions)
- Support Engineer (general administrative permissions without user management)
- Editor (content related permissions)
It also provides the OpenEuropa Authorisation Syncope submodule that is used to integrate with the Syncope authorisation service. The latter can also be provisioned as part of this repository for development purposes. See the Project setup for details.
Table of contents:
Installation
The recommended way of installing the OpenEuropa Authorisation module is via Composer.
composer require openeuropa/oe_authorisation
Enable the module
In order to enable the module in your project run:
./vendor/bin/drush en oe_authorisation
Development
The OpenEuropa Authorisation project contains all the necessary code and tools for an effective development process, such as:
- All PHP development dependencies (Drupal core included) are required by composer.json
- Project setup and installation can be easily handled thanks to the integration with the Task Runner project.
- All system requirements are containerized using Docker Composer
Project setup
Download all required PHP code by running:
composer install
This will build a fully functional Drupal test site in the ./build
directory that can be used to develop and showcase
the module's functionality.
Before setting up and installing the site make sure to customize default configuration values by copying runner.yml.dist
to ./runner.yml
and overriding relevant properties.
This will also:
- Symlink the module in
./build/modules/custom/oe_authorisation
so that it's available for the test site - Setup Drush and Drupal's settings using values from
./runner.yml.dist
- Setup PHPUnit and Behat configuration files using values from
./runner.yml.dist
After a successful setup install the site by running:
./vendor/bin/run drupal:site-install
This will:
- Install the test site
- Enable the OpenEuropa Authorisation module
For the OpenEuropa Authorisation Syncope module you need to set up the project using Docker
Using Docker Compose
Alternatively, you can build a development site using Docker and Docker Compose with the provided configuration.
Docker provides the necessary services and tools such as a web server and a database server to get the site running, regardless of your local host configuration.
Requirements:
Configuration
By default, Docker Compose reads two files, a docker-compose.yml
and an optional docker-compose.override.yml
file.
By convention, the docker-compose.yml
contains your base configuration and it's provided by default.
The override file, as its name implies, can contain configuration overrides for existing services or entirely new
services.
If a service is defined in both files, Docker Compose merges the configurations.
Find more information on Docker Compose extension mechanism on the official Docker Compose documentation.
Usage
To start, run:
docker-compose up
It's advised to not daemonize docker-compose
so you can turn it off (CTRL+C
) quickly when you're done working.
However, if you'd like to daemonize it, you have to add the flag -d
:
docker-compose up -d
The Syncope Console should be available at: http://127.0.0.1:28080/syncope-console, the default login is admin
and the password is password
.
Then:
docker-compose exec web composer install
Provisioning Syncope should happen before the site is installed, so you need to run this command:
docker-compose exec web ./vendor/bin/run oe-authorisation-service:setup
Then, in order to have a site realm and system user for your test site, you can run this command:
docker-compose exec web ./vendor/bin/run oe-authorisation-service:site-setup --site_id=sitea
(where sitea
is the Site ID (realm) of your local site).
docker-compose exec web ./vendor/bin/run drupal:site-install
Using default configuration, the development site files should be available in the build
directory and the development site
should be available at: http://127.0.0.1:8080/build.
Running the tests
To run the grumphp checks:
docker-compose exec web ./vendor/bin/grumphp run
To run the phpunit tests:
docker-compose exec web ./vendor/bin/phpunit
To run the behat tests:
docker-compose exec web ./vendor/bin/behat
Disable Drupal 8 caching
Manually disabling Drupal 8 caching is a laborious process that is well described here.
Alternatively you can use the following Drupal Console commands to disable/enable Drupal 8 caching:
./vendor/bin/drupal site:mode dev # Disable all caches. ./vendor/bin/drupal site:mode prod # Enable all caches.
Note: to fully disable Twig caching the following additional manual steps are required:
- Open
./build/sites/default/services.yml
- Set
cache: false
intwig.config:
property. E.g.:
parameters: twig.config: cache: false
- Rebuild Drupal cache:
./vendor/bin/drush cr
This is due to the following Drupal Console issue.
Contributing
Please read the full documentation for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the available versions, see the tags on this repository.