Skip to content

Commit

Permalink
Merge pull request #24 from kokspflanze/readme-fixes
Browse files Browse the repository at this point in the history
Readme fixes
  • Loading branch information
kokspflanze authored Feb 27, 2021
2 parents e0ccdf6 + 003a17b commit 1e61195
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BjyAuthorize - Acl security for Laminas / ZF3

[![Build Status](https://travis-ci.org/kokspflanze/BjyAuthorize.png?branch=master)](https://travis-ci.org/kokspflanze/BjyAuthorize)
[![Build Status](https://travis-ci.com/kokspflanze/BjyAuthorize.png?branch=master)](https://travis-ci.com/kokspflanze/BjyAuthorize)
[![Total Downloads](https://poser.pugx.org/kokspflanze/bjy-authorize/downloads.png)](https://packagist.org/packages/kokspflanze/bjy-authorize)
[![Latest Stable Version](https://poser.pugx.org/kokspflanze/bjy-authorize/v/stable.png)](https://packagist.org/packages/kokspflanze/bjy-authorize)

Expand Down Expand Up @@ -31,7 +31,7 @@ And here's how it would look like with BjyAuthorize enabled:
## Requirements

* [Laminas](https://getlaminas.org/) / [Zend Framework 2](https://github.com/zendframework/zf2)
* [LmcUser](https://github.com/Laminas-Commons/LmcUser) (optional)
* [LmcUser](https://github.com/LM-Commons/LmcUser) (optional)

## Installation

Expand All @@ -45,12 +45,11 @@ php composer.phar require kokspflanze/bjy-authorize

## Configuration

Following steps apply if you want to use `ZfcUser` with `Laminas\Db`. If you want to use Doctrine ORM/ODM, you should
also check the [doctrine documentation](https://github.com/bjyoungblood/BjyAuthorize/blob/master/docs/doctrine.md).
Following steps apply if you want to use `LmcUser` with `Laminas\Db`. If you want to use Doctrine ORM/ODM, you should
also check the [doctrine documentation](https://github.com/kokspflanze/BjyAuthorize/blob/master/docs/doctrine.md).

1. Ensure that following modules are enabled in your `application.config.php` file in the this order:
* `ZfcBase`
* `ZfcUser`
* `LmcUser`
* `BjyAuthorize`
3. Import the SQL schema located in `./vendor/BjyAuthorize/data/schema.sql`.
4. Create a `./config/autoload/bjyauthorize.global.php` file and fill it with
Expand All @@ -70,9 +69,9 @@ return [
/* this module uses a meta-role that inherits from any roles that should
* be applied to the active user. the identity provider tells us which
* roles the "identity role" should inherit from.
* for ZfcUser, this will be your default identity provider
* for LmcUser, this will be your default identity provider
*/
'identity_provider' => \BjyAuthorize\Provider\Identity\ZfcUserZendDb::class,
'identity_provider' => \BjyAuthorize\Provider\Identity\LmcUserZendDb::class,

/* If you only have a default role and an authenticated role, you can
* use the 'AuthenticationIdentityProvider' to allow/restrict access
Expand Down
2 changes: 1 addition & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Following changes are required to upgrade:
[documentation](https://github.com/bjyoungblood/BjyAuthorize/blob/master/docs/doctrine.md) instead
* The `BjyAuthorize\Provider\Identity\AuthenticationDoctrineEntity` provider was removed, use the
simpler `BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider` instead
* The `BjyAuthorize\Provider\Identity\ZfcUserDoctrine` provider was removed, use the
* The `BjyAuthorize\Provider\Identity\LmcUserDoctrine` provider was removed, use the
simpler `BjyAuthorize\Provider\Identity\AuthenticationIdentityProvider` instead
* Following methods were removed from the `BjyAuthorize\Provider\Identity\ProviderInterface`:
* `getDefaultRole`
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
},
"suggests": {
"laminas/laminas-developer-tools": "if you need to see current authorization details while developing",
"lm-commons/lmc-user": "LmcUser provides a good default setup to get started with bjyauthorize"
"lm-commons/lmc-user": "LmcUser provides a good default setup to get started with bjyauthorize",
"lm-commons/lmc-user-doctrine-orm": "To support Doctrine with LmcUser"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion data/User.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MyNamespace;
use BjyAuthorize\Provider\Role\ProviderInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use ZfcUser\Entity\UserInterface;
use LmcUser\Entity\UserInterface;

/**
* An example of how to implement a role aware user entity.
Expand Down
2 changes: 1 addition & 1 deletion data/User.php.odm.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MyNamespace;
use BjyAuthorize\Provider\Role\ProviderInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use ZfcUser\Entity\UserInterface;
use LmcUser\Entity\UserInterface;
use MyNamespace\Role;

/**
Expand Down
26 changes: 13 additions & 13 deletions docs/doctrine.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,54 @@ If you wish to use Doctrine 2 ORM entities (ORM) or MongoDB ODM Documents (ODM),
having your authentication identity implement either `Laminas\Permissions\Acl\Role\RoleInterface` or
`BjyAuthorize\Provider\Role\ProviderInterface`.

## BjyAuthorize, ZfcUser and ZfcUserDoctrineORM
## BjyAuthorize, LmcUser and LmcUserDoctrineORM

Here's some simple steps to do this specifically with `ZfcUserDoctrineORM`, though any authentication service
Here's some simple steps to do this specifically with `LmcUserDoctrineORM`, though any authentication service
will work too:


### Installation

Install and enable `ZfcUser` and `ZfcUserDoctrineORM`:
Install and enable `LmcUser` and `LmcUserDoctrineORM`:

```sh
php composer.phar require zf-commons/zfc-user-doctrine-orm:0.1.*
php composer.phar require lm-commons/lmc-user-doctrine-orm
```

You will obviously need to enable all the involved modules

### Implement a `MyNamespace\User` and a `MyNamespace\Role` entities

Implement a `MyNamespace\User` and a `MyNamespace\Role` entity.
You can use the [`User.php.dist`](https://github.com/bjyoungblood/BjyAuthorize/blob/master/data/User.php.dist)
and [`Role.php.dist`](https://github.com/bjyoungblood/BjyAuthorize/blob/master/data/Role.php.dist) files as blueprint.
You can use the [`User.php.dist`](https://github.com/kokspflanze/BjyAuthorize/blob/master/data/User.php.dist)
and [`Role.php.dist`](https://github.com/kokspflanze/BjyAuthorize/blob/master/data/Role.php.dist) files as blueprint.

### Configuration

You will need to override the settings of `ZfcUserDoctrineORM` to use the entities you defined:
You will need to override the settings of `LmcUserDoctrineORM` to use the entities you defined:

```php
return array(
'doctrine' => array(
'driver' => array(
// overriding zfc-user-doctrine-orm's config
'zfcuser_entity' => array(
// overriding lmc-user-doctrine-orm's config
'lmcuser_entity' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'paths' => 'path/to/your/entities/dir',
),

'orm_default' => array(
'drivers' => array(
'MyNamespace' => 'zfcuser_entity',
'MyNamespace' => 'lmcuser_entity',
),
),
),
),

'zfcuser' => array(
// telling ZfcUser to use our own class
'lmcuser' => array(
// telling LmcUser to use our own class
'user_entity_class' => 'MyNamespace\User',
// telling ZfcUserDoctrineORM to skip the entities it defines
// telling LmcUserDoctrineORM to skip the entities it defines
'enable_default_entities' => false,
),

Expand Down
2 changes: 1 addition & 1 deletion docs/unauthorized-strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Module

$strategy = new RedirectionStrategy();

// eventually set the route name (default is ZfcUser's login route)
// eventually set the route name (default is LmcUser's login route)
$strategy->setRedirectRoute('my/route/name');

// eventually set the URI to be used for redirects
Expand Down

0 comments on commit 1e61195

Please sign in to comment.