xelax90/zf-user-entity

Provides a user and role entity to work with ZfcUser, Doctrine 2 and BjyAuthorize

1.0 2016-12-10 15:14 UTC

This package is auto-updated.

Last update: 2024-12-20 01:19:43 UTC


README

This module provides configuration and entities for ZfcUser, DoctrineORM and BjyAuthorize. The user entity also implements the LocaleUserInterface required by xelax90/zf2-language-route.

Installation

Installation of XelaxUserModule uses composer. For composer documentation, please refer to getcomposer.org.

composer require xelax90/zf-user-module

Then add XelaxLanguageRoute to your config/application.config.php and run the doctrine schema update to create the database table:

php vendor/bin/doctrine-module orm:schema-tool:update --force 

Now copy the provided vendor/xelax90/zf-user-module/config/xelax-user-module.global.php into your config/autoload directory. This file provides the basic configuration for ZfcUser, DoctrineORM and BjyAuthorize to work with this module. This file does not contain all ZfcUser configuration options. Please refer to the ZfcUser documentation or configuration for more details.

Configuration

You can configure this module in the config/autoload/xelax-user-module.global.php file. All options are described there.

The user state in ZfcUser is enabled and is treated as a bitmask. The least significant bit is always the 'Login Allowed' state. Other modules can use other bits to store additional information. It is assumed, that only fife bits are used. You can adjust this number in the allowed_login_states configuration option.

Custom user entity

If you want to add attributes to the user entity, you can simply follow these steps:

  1. Create your entity in your namespace and subclass \XelaxUserEntity\Entity\User. Don't forget the Doctrine annotations
  2. Change user_entity_class configuration option in config/autoload/xelax-user-entity.global.php to your entity class