Skip to content

EavModule Installation Guide

iAchilles edited this page Oct 21, 2014 · 7 revisions

The eavactiverecord extension should be installed, as described here, before using EavModule.

The process of installing the module is typically quite simple and similar to installing other Yii modules. Follow the instructions below:

  1. Create the directory "protected/modules" and move the directory "eav" ("protected/components/eavactiverecord/modules/eav") there.

  2. Add the following lines in the file "protected/config/main.php":

    'modules' => array('eav')
  3. Create the directory "assets" in the webroot directory. The assets directory is used to hold asset files like .css, .js, etc.


Now you can access the module pages.

The EAV attributes management page: http:://yourdomain.com/eav/attribute/

The EAV attribute sets management page: http:://yourdomain.com/eav/set/


By default anyone can access the module.
You need to set up access control filter or role-based access, to give permissions for only necessary users to perform the controller action inside the module.

To set up access control filter, please follow the example below :

protected/confing/main.php

'modules' => array(
        'eav' => array(
            'filters' => array('set' => array('accessControl'),
                               'attribute' => array('accessControl')
            ),
            'accessRules' => array(
                'set' => array(
                    array('allow',
                          'actions' => array('index', 'create', 'update', 'delete'),
                          'users' => array('@')
                    ),
                    array('deny')
                ),
                'attribute' => array(
                    array('allow',
                          'actions' => array('index', 'create', 'update', 'delete'),
                          'users' => array('@')
                    ),
                    array('deny')
                ),
            ),
        ))

To set up role-based access you can use the following code:

'modules' => array(
        'eav' => array(
            'filters' => array('set' => array('accessControl'),
                               'attribute' => array('accessControl')
            ),
            'accessRules' => array(
                'set' => array(
                    array('allow',
                          'actions' => array('index'),
                          'roles' => array('readEavSet')
                    ),
                    array('allow',
                          'actions' => array('create'),
                          'roles' => array('createEavSet')
                    ),
                    array('allow',
                          'actions' => array('update'),
                          'roles' => array('updateEavSet')
                    ),
                    array('allow',
                          'actions' => array('delete'),
                          'roles' => array('deleteEavSet')
                    ),
                    array('deny')
                ),
                'attribute' => array(
                    array('allow',
                          'actions' => array('index'),
                          'roles' => array('readEavAttribute')
                    ),
                    array('allow',
                          'actions' => array('create'),
                          'roles' => array('createEavAttribute')
                    ),
                    array('allow',
                          'actions' => array('update'),
                          'roles' => array('updateEavAttribute')
                    ),
                    array('allow',
                          'actions' => array('delete'),
                          'roles' => array('deleteEavAttribute')
                    ),
                    array('deny')
                ),
            ),
        ))

Keep in mind that there are just examples, so you can add your own access rules as needed.

Also you can change the number of items displayed per page (the default value is set to 50):

'modules' => array('eav' => array('itemsPerPage' => 20)),

#####Screenshots of the module

The EAV attributes management page EavModule screenshot


The EAV attribute sets management page ![EavModule screenshot](https://docs.google.com/uc?export=download&id=0B3d3iXSyCBTiTXZmS2xwZ2FQN0U)
The Eav attribute edit page ![EavModule screenshot](https://docs.google.com/uc?export=download&id=0B3d3iXSyCBTiSGVuUE5CLVo4WFE)
The Eav attribute set edit page ![EavModule screenshot](https://docs.google.com/uc?export=download&id=0B3d3iXSyCBTia2hnTUVNMkkwd0U)