mouf/security.daos.tdbm

This package contains a basic user/role/right database model for TDBM.

v1.2.1 2022-12-06 15:28 UTC

This package is auto-updated.

Last update: 2024-11-06 19:24:21 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality

TDBM DAOs for Mouf security

What is it?

This package contains a set of TDBM DAOs adding a basic user / role / right support for Mouf security.

This package will create tables for users, roles and rights.

Installation

Run:

composer require mouf/security.daos.tdbm

Then, go to the Mouf user interface.

In Mouf:

  • run the install tasks.
  • apply the database patches
  • regenerate TDBM DAOs

At this point, you should have a database with 4 additional tables: users, users_roles, roles, roles_rights.

Check the newly generated UserBean class.

Change this class so that:

  • it extends UserInterface
  • it uses the UserTrait
use Mouf\Security\DAO\UserTrait;
use Mouf\Security\UserService\UserInterface;

/**
 * The UserBean class maps the 'users' table in database.
 */
class UserBean extends UserBaseBean implements UserInterface
{
    use UserTrait;
}

Adding new rights

Available rights are listed in the Mouf\Security\Rights\RightsRegistry. The RightsRegistry contains a list of rights implementing the RightInterface.

In order to add a new right, connect to Mouf, edit the Mouf\Security\Rights\RightsRegistry instance and drag'n'drop new rights in the rights property.