2017 © Pedro Peláez
 

symfony-bundle redmine-user-provider-bundle

A bundle to use Redmine as a user provider for Symfony projects.

image

gmaissa/redmine-user-provider-bundle

A bundle to use Redmine as a user provider for Symfony projects.

  • Saturday, April 15, 2017
  • by GMaissa
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

RedmineUserProviderBundle Packagist

master SensioLabsInsight Scrutinizer Build Status Code Coverage

About

A bundle to use Redmine as a user provider., (*1)

Installation

The recommended way to install this bundle is through Composer. Just run :, (*2)

composer require gmaissa/redmine-user-provider-bundle

Register the bundle in the kernel of your application :, (*3)

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new GMaissa\RedmineUserProviderBundle\GmRedmineUserProviderBundle(),
    );

    return $bundles;
}

Use the Redmine user provider in your security.yml file :, (*4)

# app/config/security.yml
security:
    ...
    providers:
        app:
            id: gm_redmine_user_provider.provider
    ...

Configuration reference

# app/config/config.yml
gm_redmine_user_provider:
    redmine:
        url:                  ~ # Required
        allowed_domains:      []
    user_class:           GMaissa\RedmineUserProviderBundle\Model\RedmineUser
    persistence_driver:   ~ # One of "orm"
    oauthserver_bridge:   false

Persist your User

User entity class

Implement your own User Entity class, extending GMaissa\RedmineUserProviderBundle\Entity\User and declare it in the bundle configuration :, (*5)

# app/config/config.yml
gm_redmine_user_provider:
    ...
    user_class: AppBundle\Entity\User

Using a provided user repository

Enable the provided persistence driver you want to use (for now only Doctrine ORM is provided) :, (*6)

# app/config/config.yml
gm_redmine_user_provider:
    ...
    user_class: AppBundle\Entity\User
    persistence_driver: orm

Using a custom user repository

Implements the GMaissa\RedmineUserProviderBundle\Repository\UserRepositoryInterface interface for your repository serviceand tag is as agm_redmine_user_provider.user_repository :, (*7)

# services.yml
services:
    app.user_repository:
        class: AppBundle\Repository\UserReposioty
        tags:
            -  {name: gm_redmine_user_provider.user_repository}

Using with FOSOAuthServerBundle

Enable the OAuth Server Bridge :, (*8)

# app/config/config.yml
gm_redmine_user_provider:
    ...
    oauthserver_bridge: true

You can now use the OAuth Storage service gm_redmine_user_provider.bridge.oauth.storage :, (*9)

# app/config/config.yml
fos_oauth_server:
    ...
    service:
        storage: gm_redmine_user_provider.bridge.oauth.storage

Implementing your own User Factory

If you want to use a custom User Factory, implement the GMaissa\RedmineUserProviderBundle\Factory\UserFactoryInterface interface, register your service and alias it as gm_redmine_user_provider.factory.user., (*10)

# services.yml
services:
    app.redmine_user_provider.user_factory:
        class: AppBundle\Factory\CustomUserFactory
        calls:
            - [setUserClass, ["%gm_redmine_user_provider.user_class%"]]
        alias: gm_redmine_user_provider.factory.user

Using your own Redmine Api Client

Like the custom User Factory, implement the GMaissa\RedmineUserProviderBundle\ApiClient\RedmineApiClientInterface interface, register your service and alias it as gm_redmine_user_provider.api.client., (*11)

# services.yml
services:
    app.redmine_user_factory.api_client:
        class: AppBundle\ApiClient\CustomApiClient
        arguments:
            - "%gm_redmine_user_provider.redmine.url%"
        alias: gm_redmine_user_provider.api.client

Running tests

Install the dev dependencies :, (*12)

composer install --dev, (*13)

Run PHPUnit test suite :, (*14)

php vendor/bin/phpunit

Contributing

In order to be accepted, your contribution needs to pass a few controls :, (*15)

  • PHP files should be valid
  • PHP files should follow the PSR-2 standard
  • PHP files should be phpmd and phpcpd warning/error free

To ease the validation process, install the pre-commit framework and install the repository pre-commit hook :, (*16)

pre-commit install

Finally, in order to homogenize commit messages across contributors (and to ease generation of the CHANGELOG), please apply this git commit message hook onto your local repository., (*17)

License

This bundle is released under the MIT license. See the complete license in the bundle:, (*18)

src/Resources/meta/LICENSE

The Versions