Yii 1.1: yii-user-management

Yii User Management Module
169 followers

This is a modular User Management Module for easy integration in your Yii Framework Web Application.

It has the following features:

* An automated Installer
* User Administration
* Role Administration
* Permission System with a mixture of RBAC and ACL (see docs)
* Profiles & Profile history & Profile Comments & Profile Fields Administration
* Messaging System (send/receive Messages between Users) Submodule
* User groups (user can add new groups, other users can join)
* User Avatar upload
* User Registration
* Password Recovery
* Friendship system
* Mailing component (users can choose which messages he gets by email)
* Base Language: English 
* Complete Translations to german, french
* Almost complete Translation to spain thanks to bigchirv@gmail.com
* Incomplete Translations to russian and polish

What it is not:

* A complex RBAC like srbac. However, it is possible to use srbac together with the User Management Module without problems. The contributed Permission System may be powerful enough for your Web Application, just give it a try.

Community

Yii-user-management is hosted at github: github.com/thyseus/yii-user-management

Donations are possible by bitcoin: 1AzhCYHrX7c7exBB89qfhbEvUaW6RThB1E

Documentation

Requirements

  • minimum of Yii 1.1.8 since DAO caching techniques are used

Installation

  • Extract the release file under protected/modules
  • Read docs/Install_tutorial.txt

  • Enjoy

Total 20 comments

#18404 report it
thyseus at 2014/10/24 08:34am
Yum development

I still develop yii-user-management on github:

https://github.com/thyseus/yii-user-management

a lot of bugfixes have happened there, and its really time for a new stable release.

Bugs will be fixed for all time, but no new features will go into yii-user-management (at least not from me, i accept pull requests of course !)

In the long-term i will contribute to existing yii 2 user modules.

#18403 report it
Mariaczi+PL at 2014/10/24 08:09am
Compatible with Yii 2?

Is it? Is someone going to update this great extension?

#18223 report it
skworden at 2014/09/29 02:59pm
install Bugs

I just tried this out today and hit a bunch of errors here are just a few that i ran into in the first few minutes of using it.

Before you run the installer you must create the translation table

CREATE TABLE IF NOT EXISTS translation (
            `message` varbinary(255) NOT NULL,
            `translation` char(255) NOT NULL,
            `language` char(5) NOT NULL,
            `category` char(255) NOT NULL,
            PRIMARY KEY (`message`,`language`,`category`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

after you run the installer you will get an array of items to add to your config->main->modules along with that code add

'registration' => array(
            'registrationUrl' => '../registration/registration/registration',
        ),

You dont have to comment anything out like @cappadochian suggested. This could cause problems later just add the above line to your config main.

Also, while in your config->main add all of the user modules you wish to use in the import section. Once the module gets updated you shouldn't have to import all of them. until then...auto load them all.

'import'=>array(
...other imports...
        'application.modules.user.models.*',
        'application.modules.membership.models.*',
        'application.modules.registration.models.*',
        'application.modules.friendship.models.*',
        'application.modules.profile.models.*',
        'application.modules.role.models.*',
        'application.modules.usergroup.models.*',
),

or you will get a bunch of errors for not being able to find models.

Also, another point is this modules uses <? in some places and <?php, I'd recommend changing all of the <? to <?php because if your like me you will just get a bunch of php code on the screen that doesn't render correctly.

You can see all the current Issues on github here is the one for the comment below this. https://github.com/thyseus/yii-user-management/issues/194

Also, you can use your own layouts by overriding the default ones i.e. in your config main under module->users you can do something like the following

'user' => array(
            'debug' => false,
            'passwordRequirements' => array('minLen' => 9, 'maxLen' => 30, 'maxRepetition' => 5, 'minDigits' => 3,),
            'userTable' => 'user',
            'translationTable' => 'translations',
            'layout' => '//layouts/column2',
            'loginLayout' => '//layouts/column2',
            'adminLayout' => '//layouts/column2',
        ),

By using //layouts/yourLayoutFileName yii will first look in your theme (if you are using one) then look in your protected/site/views/layouts/.

Note that this might not show any of the buttons associated with the module. You can create your own layouts under your theme or where ever and use them with the modules menus etc and leave the module alone since it will probably change frequently. You would have to do the same for every module you are using under the module. For newbies you can almost always override any $public variable in the modules main file..this is one of the reasons it's public.

Other Errors I found

line 23 of modules/profile/views/profile/views.php

'user.friendship.views.friendship.friends', array(
 
and needs to be
 
'friendship.views.friendship.friends', array(

line 442 of modules/user/friendship/models/YumFriendship.php

is 
Yii::import('user.friendship.models.YumFriendship');
 
needs to be
 
Yii::import('friendship.models.YumFriendship');

line 32 in modules/friendship/views/friendship/friendship.php

Yii::import('user.friendship.controllers.YumFriendshipController');
 
needs to be
 
Yii::import('friendship.controllers.YumFriendshipController');

lines 46-57 in modules/profile/controllers/yumPrivacysettingController.php

if (isset($_POST['YumProfile'])) {
                $profile = $model->user->profile;
                $profile->attributes = $_POST['YumProfile'];
                $profile->validate();
            }
 
            if (!$model->hasErrors()) {
                $profile->save();
                $model->save();
                Yum::setFlash('Your privacy settings have been saved');
                $this->redirect(array('//profile/profile/view', 'id' => $model->user_id));
            }
Needs to be
 
if (isset($_POST['YumProfile'])) {
                $profile = $model->user->profile;
                $profile->attributes = $_POST['YumProfile'];
                $profile->validate();
 
 
                if (!$model->hasErrors()) {
                    $profile->save();
                    $model->save();
                    Yum::setFlash('Your privacy settings have been saved');
                    $this->redirect(array('//profile/profile/view', 'id' => $model->user_id));
                }
            }
still doesn't save after this though

unfortunately I need a user management / RBAC by tomorrow and it's going to be faster to write my own then to try and fix this/wait for updates :(. Along with hitting errors on almost every page this is doing upwards of 14-15 queries per page in some of the user views and that is absolutely crazy for what it's doing. It also stores the translations in the db which I don't like either (just personal preference). Needless to say I won't be updating this.

This looks promising and hopefully the bugs will get worked out.

#18155 report it
cappadochian at 2014/09/17 03:50pm
?

Okay I'm only a beginner, but I do as the instructions and it simply doesn't work for me. "The table "{{user}}" for active record class "YumUser" cannot be found in the database." Wher is it told that I have to make one? And do I have to make a model also? But when I have a user table I get another error message.

UPDATE: I got closer to the solution. a translation table is needed but this is mentioned nowhere. link

next, a users table is needed, i've made one with a few usual fields. now the installer appeared.

now I get a "Trying to get property of non-object" in modules\user\views\user\login.php(124)

You can register <?php echo CHtml::link('here', Yum::module('registration')->registrationUrl);?>

what next?! this gets me crazy.

UPDATE_2: if I comment out the registration link, it seems to work. somehow it needs to be fixed, but I don't know if I'm able to do that yet.

otherwise, it's a mess. I don't think it's a usable thing. I finish dealing with this.

#17516 report it
Patrick Bos Kessen at 2014/06/26 06:05am
fix for problems:)

short_open_tag was the issue. I found the tip to put short_open_tagS = on in my php.ini but that didn't help;-) I tested the short open tag and found out.

I removed the S in my php.ini, restarted Apache and it works:-)

#17514 report it
Patrick Bos Kessen at 2014/06/26 05:50am
update to problem

I found an error in my main.php which I corrected and now

http://beebuy.nl/webapp/index.php?r=user/install

leads to:

PHP warning
 
include(UserModule.php): failed to open stream: No such file or directory
 
/Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/YiiBase.php(427)
 
415                         {
416                             include($classFile);
417                             if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php')
418                                 throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array(
419                                     '{class}'=>$className,
420                                     '{file}'=>$classFile,
421                                 )));
422                             break;
423                         }
424                     }
425                 }
426                 else
427                     include($className.'.php');
428             }
429             else  // class name with namespace in PHP 5.3
430             {
431                 $namespace=str_replace('\\','.',ltrim($className,'\\'));
432                 if(($path=self::getPathOfAlias($namespace))!==false)
433                     include($path.'.php');
434                 else
435                     return false;
436             }
437             return class_exists($className,false) || interface_exists($className,false);
438         }
439         return true;
Stack Trace
#0  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/YiiBase.php(427): YiiBase::autoload()
#1  
 unknown(0): YiiBase::autoload("UserModule")
#2  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/YiiBase.php(206): spl_autoload_call("UserModule")
#3  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/base/CModule.php(282): YiiBase::createComponent("user.UserModule", "user", null, array("debug" => true))
#4  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CWebApplication.php(337): CModule->getModule("user")
#5  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CWebApplication.php(276): CWebApplication->createController("user/install")
#6  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CWebApplication.php(141): CWebApplication->runController("user/install")
#7  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/base/CApplication.php(180): CWebApplication->processRequest()
#8  
–  /Library/Server/Web/Data/Sites/beebuy.nl/webapp/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
14 
15

http://beebuy.nl/webapp/ leads to:

PHP warning
 
include(YumWebUser.php): failed to open stream: No such file or directory
 
/Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/YiiBase.php(427)
 
415                         {
416                             include($classFile);
417                             if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php')
418                                 throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array(
419                                     '{class}'=>$className,
420                                     '{file}'=>$classFile,
421                                 )));
422                             break;
423                         }
424                     }
425                 }
426                 else
427                     include($className.'.php');
428             }
429             else  // class name with namespace in PHP 5.3
430             {
431                 $namespace=str_replace('\\','.',ltrim($className,'\\'));
432                 if(($path=self::getPathOfAlias($namespace))!==false)
433                     include($path.'.php');
434                 else
435                     return false;
436             }
437             return class_exists($className,false) || interface_exists($className,false);
438         }
439         return true;
Stack Trace
#0  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/YiiBase.php(427): YiiBase::autoload()
#1  
 unknown(0): YiiBase::autoload("YumWebUser")
#2  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/YiiBase.php(217): spl_autoload_call("YumWebUser")
#3  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/base/CModule.php(386): YiiBase::createComponent(array("class" => "application.modules.user.components.YumWebUser", "allowAutoLogin" => true, "loginUrl" => array("//user/user/login")))
#4  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/base/CModule.php(103): CModule->getComponent("user")
#5  
–  /Library/Server/Web/Data/Sites/beebuy.nl/webapp/themes/bootstrap/views/layouts/main.php(25): CModule->__get("user")
20             'class'=>'bootstrap.widgets.TbMenu',
21             'items'=>array(
22                 array('label'=>'Home', 'url'=>array('/site/index')),
23                 array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
24                 array('label'=>'Contact', 'url'=>array('/site/contact')),
25                 array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
26                 array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
27             ),
28         ),
29     ),
30 )); ?>
#6  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CBaseController.php(126): require("/Library/Server/Web/Data/Sites/beebuy.nl/webapp/themes/bootstrap...")
#7  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CBaseController.php(95): CBaseController->renderInternal("/Library/Server/Web/Data/Sites/beebuy.nl/webapp/themes/bootstrap...", array("content" => "<div id="content"> <div class="hero-unit"><h1>Welcome to My Be..."), true)
#8  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/widgets/CContentDecorator.php(76): CBaseController->renderFile("/Library/Server/Web/Data/Sites/beebuy.nl/webapp/themes/bootstrap...", array("content" => "<div id="content"> <div class="hero-unit"><h1>Welcome to My Be..."), true)
#9  
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/widgets/CContentDecorator.php(54): CContentDecorator->decorate("<div id="content"> <div class="hero-unit"><h1>Welcome to My Be...")
#10 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/widgets/COutputProcessor.php(44): CContentDecorator->processOutput("<div id="content"> <div class="hero-unit"><h1>Welcome to My Be...")
#11 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CBaseController.php(206): COutputProcessor->run()
#12 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CBaseController.php(300): CBaseController->endWidget("CContentDecorator")
#13 
–  /Library/Server/Web/Data/Sites/beebuy.nl/webapp/protected/views/layouts/column1.php(6): CBaseController->endContent()
1 <?php /* @var $this Controller */ ?>
2 <?php $this->beginContent('//layouts/main'); ?>
3 <div id="content">
4     <?php echo $content; ?>
5 </div><!-- content -->
6 <?php $this->endContent(); ?>
#14 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CBaseController.php(126): require("/Library/Server/Web/Data/Sites/beebuy.nl/webapp/protected/views/...")
#15 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CBaseController.php(95): CBaseController->renderInternal("/Library/Server/Web/Data/Sites/beebuy.nl/webapp/protected/views/...", array("content" => " <div class="hero-unit"><h1>Welcome to My BeeBuy Web Application..."), true)
#16 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CController.php(784): CBaseController->renderFile("/Library/Server/Web/Data/Sites/beebuy.nl/webapp/protected/views/...", array("content" => " <div class="hero-unit"><h1>Welcome to My BeeBuy Web Application..."), true)
#17 
–  /Library/Server/Web/Data/Sites/beebuy.nl/webapp/protected/controllers/SiteController.php(32): CController->render("index")
27      */
28     public function actionIndex()
29     {
30         // renders the view file 'protected/views/site/index.php'
31         // using the default layout 'protected/views/layouts/main.php'
32         $this->render('index');
33     }
34 
35     /**
36      * This is the action to handle external exceptions.
37      */
#18 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/actions/CInlineAction.php(49): SiteController->actionIndex()
#19 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CController.php(308): CInlineAction->runWithParams(array())
#20 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CController.php(286): CController->runAction(CInlineAction)
#21 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array())
#22 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CWebApplication.php(282): CController->run("")
#23 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/web/CWebApplication.php(141): CWebApplication->runController("")
#24 
+  /Library/Server/Web/Data/Sites/beebuy.nl/yii/framework/base/CApplication.php(180): CWebApplication->processRequest()
#25 
+  /Library/Server/Web/Data/Sites/beebuy.nl/webapp/index.php(13): CApplication->run()

Please help:-)

#17510 report it
Patrick Bos Kessen at 2014/06/25 09:45am
doesn't seem to work

Hi,

this step...

6.) Run the User Management Installer in your Web-Browser:
 
http://localhost/testdrive/index.php/user/install
or
http://localhost/testdrive/index.php?r=user/install
 
depending on your URL route setup.

leaves me with a blank page.

When I remove

'user' => array(
            'debug' => true,
            )
        ),

from the modules section in main.php I get......

user->data()->profile->firstname; public function data() { if($this->_data instanceof YumUser) return $this->_data; else if($this->id && $this->_data = YumUser::model()->findByPk($this->id)) return $this->_data; else return $this->_data = new YumUser(); } public function checkAccess($operation, $params=array(), $allowCaching=true) { if(!Yum::hasModule('role') ||    Yum::module('role')->useYiiCheckAccess ) return parent::checkAccess($operation, $params, $allowCaching); return $this->can($operation);  } public function can($action) { Yii::import('application.modules.role.models.*'); foreach ($this->data()->getPermissions() as $permission) if ($permission == $action) return true; return false; } /** * Checks if this (non-admin) User can administrate some users */ public static function hasUsers($uid = 0) { if($uid == 0) $uid = Yii::app()->user->id; $user = YumUser::model()->cache(500)->findByPk($uid); return isset($user->users) && $user->users !== array(); } public static function hasRoles($uid = 0) { if($uid == 0) $uid = Yii::app()->user->id; $user = YumUser::model()->cache(500)->findByPk($uid); $flag = false; if(isset($user->roles)) foreach($user->roles as $role) if (isset($role->roles) && $role->roles !== array()) $flag = true; return $flag; } public function getRoles() { $t = ' '; $user = Yii::app()->user->data(); $roles = $user->roles; if($user instanceof YumUser && $roles) foreach($roles as $role) $t .= $role->title .' '; return $t; } /** * Checks if this (non-admin) User can administrate the given user */ public static function hasUser($username, $uid = 0) { if($uid == 0) $uid = Yii::app()->user->getId(); // Every user can modify himself if($username == $uid) return true; $user = YumUser::model()->cache(500)->findByPk($uid); if(!is_array($username)) $username = array ($username); if(isset($user->users)) foreach($user->users as $userobj) { if(in_array($userobj->username, $username) || in_array($userobj->id, $username)) return true; } return false; } /** * Checks if the user has the given Role * @mixed Role string or array of strings that should be checked * @int (optional) id of the user that should be checked * @return bool Return value tells if the User has access or hasn't access. */ public function hasRole($role, $uid = 0) { if(Yum::hasModule('role')) { Yii::import('application.modules.role.models.*'); if($uid == 0) $uid = Yii::app()->user->id; if(!is_array($role)) $role = array ($role); if($uid && $user = YumUser::model()->with('roles')->find( 't.id = '.$uid)) { // Check if a user has a active membership and, if so, add this // to the roles $roles = $user->roles; if(Yum::hasModule('membership')) $roles = array_merge($roles, $user->getActiveMemberships()); if(isset($roles)) foreach($roles as $roleobj) { if(in_array($roleobj->title, $role) || in_array($roleobj->id, $role)) return true; } } } return false; } public function loggedInAs() { if($this->isGuest) return Yum::t('Guest'); else return $this->data()->username; } /** * Return admin status. * @return boolean */ public function isAdmin() { if($this->isGuest) return false; else return Yii::app()->user->data()->superuser; } } ?>

as browseroutput when I visit... http://beebuy.nl/webapp/index.php?r=user/install

visiting http://beebuy.nl/webapp/index.php

gets me

PHP warning
 
include(YumWebUser.php): failed to open stream: No such file or directory
 
and more

This is how I put the extension in my tree

What am I missing?

Sincerely,

Patrick

#17053 report it
Neminath at 2014/04/29 03:05am
instalation method

Tutorial for installing and configuring the Yii User Management Module.

In this Tutorial we will learn how to use the User Management Module on a fresh created Yii Web Application. Installation under an existing application is identical to these instructions.

1.) Generate your Webapp:

$ php yii-1.1.10/framework/yiic webapp testdrive Create a Web application under '/var/www/testdrive'? [Yes|No] Yes

[...]

Your application has been created successfully under /var/www/testdrive.

2.) The Yii User Management Module needs a Database Connection to work. You now have to setup your MySQL Database and insert the connection URI in your Application configuration, like this:

'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=testdrive', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8', // prior to yum0.8rc7 tablePrefix is not necessary anymore, but it can not hurt 'tablePrefix' => '',
),

$ mysql -u root localhost

CREATE DATABASE testdrive ;

3.) Extract the Yii User Management Module under the modules/ directory of your new Web Application. Replace the _0.8 with the latest Version available.

$ cd testdrive/protected $ mkdir modules $ cd modules $ wget http://www.yiiframework.com/extension/yii-user-management/files/User_Management_Module_0.8.tar.bz2 $ tar xvf User_Management_Module_0.8.tar.bz2

4.) The Yii-user-management module contains submodules that you just extracted into your application's modules/ directory. The installation script will provide

$ [youreditor] protected/config/main.php

Add these lines:

'modules' => array( 'user' => array( 'debug' => true, ) ),

The debug option is needed for the installation and should be set to false after the installation.

5.) To let your Web Application use the Authentification Methods of the User Management Module, we need to overwrite the default Authentification Method in the Application Configuration:

'components'=>array( 'user'=>array( 'class' => 'application.modules.user.components.YumWebUser', 'allowAutoLogin'=>true, 'loginUrl' => array('//user/user/login'), [...] ),

'import'=>array(
'application.modules.user.models.*', [...]

This tells our Web Application that is can access the Model 'User' even when not in the modules/user environment. This is needed for calling User::hasRole($role) in your Code to check if the logged in User belongs to the role. This is explained in the detailed Documentation. It is good to let this line occur as the first included Model, so you can extend the User-Model with your own in your Application models/ Directory if you like.

6.) Run the User Management Installer in your Web-Browser:

http://localhost/testdrive/index.php/user/install or http://localhost/testdrive/index.php?r=user/install

depending on your URL route setup.

7.) Now the Installer of the User Management Module should appear. To the right you can set up alternate Table Names used by the Module. In most cases this is not needed and you can keep this Settings. If you do change this, be sure to set up the correct table Names in your Application Configuration, so the User Module can access them.

Click 'Install Module'. After clicking it, the install script will create the database tables needed by the module(s). Then it will show you the neccesary modifications to be made. Add the Modules you need to your Application Configuration as provided by the install script in config/main.php. You can also remove the Yum modules you don't want to use.

8.) Make sure to set a caching component. Yum relies on it. If you do not want to cache, add

'components' => array(
        'cache' => array('class' => 'system.caching.CDummyCache'),

to your config/main.php.

Also see http://www.yiiframework.com/doc/guide/1.1/en/caching.overview about some general information about caching in yii.

9.) Congratulations, you have installed the User Management Module! Lets tidy up a little bit:

10.) Login as admin/admin and navigate to index.php?r=user/user/admin. This is your user management administration panel. Click on "Administrate your Users" Now you are taken to the default Front-End Login-Screen of the User Management Module. Log in with the Username admin and Password admin.

11.) Click on the 'update Icon' (the pencil) of your administrator User. Change the Password to something more safe than 'admin'. Click Save.

12.) If you already didn't do it, remove the 'debug' => 'true' line from youri Application Configuration so your new data doesn't get overwritten accidentally by the installation process.

Configuration of your freshly installed User Management Module:

Language:

The Yii-User Management Module uses the language that is set in the Application Configuration. For example, you can add a

'language' => 'de',

in your config/main.php to get German Language strings. At the moment English, German, French and Polish are supported.

Quick Login Widget:

If you want to display a quick login widget somewhere in your Web Application, just call in your view file:

<? $this->widget('application.modules.user.components.LoginWidget'); ?>

Password Requirements:

You can setup the password Requirements within the 'passwordRequirements' option of the Module, for example:

'user' => array( 'passwordRequirements' => array(
'minLen' => 4, 'maxLen' => 16, 'maxRepetition' => 2, 'minDigits' => 3, ),

Please see components/CPasswordValidator.php for possible password requirement options

User Registration:

Set the Variable 'enableActivationConfirmation' to false in the module configuration to let users register for your application without needing to receive/click an emailed confirmation link.

Role Management:

You can add up new roles in the Role Manager. To check for access to this roles, you can use this code Snippet everywhere in your Yii Application. Most likely it will be used in the ACL Filter of your Controllers:

if(Yii::app()->user->can('action')) { // user is allowed } else { // user is not allowed to do this }

Please see the file docs/logging.txt for information on how to set up the logging functions of the Yii User Management module.

Where to go from now on?

There are some examples on how to extend from the Yii User Management Module and how to implement project-specific stuff. See the files in the docs/ directory for all this.

FAQ:

Q: I get an exception when running the Installer

A: Please make sure to log out from any session. Clear your cookies to make sure you are not logged in in your Web Application anymore.

Q: I get the error Message: CWebUser does not have a method named "isAdmin":

A: Please make sure that you have the following in your application configuration:

'components'=>array(
    'user'=>array(
        'class' => 'application.modules.user.components.YumWebUser',

Q: I get the error Message: the table "{{users}}" for active record class "YumUser" cannot be found in the database.

A: Please make sure that you have the following in your application configuration:

    'db'=>array(
        'tablePrefix' => '',
        [...]

Q: Why doesn´ t the yii-user-management have submodules?

A: Submodules are supported by yii, but having a path like application.modules.user.modules.role.controllers.YumRoleController really looks strange, so we decided it is better to keep all modules inside the root modules/ directory.

Q: I get the following error while installing: General error: 2014 Cannot execute queries while other unbuffered queries are active

A: thanks to NetDabbler, there is a workaround:

Comment the folowing lines in YumInstallController.php // $sql = file_get_contents(Yii::getPathOfAlias('application.modules.user.docs') . '/yum_translation.sql'); // $db->createCommand($sql)->execute();

Insert the translation data manually in a cmd window as: mysql -u yourusername -p testyum < docs/yum_translation.sql

Q: I still got errors !

A: Make sure to enable a caching component, at least CDummyCache, in your config/main.php:

'cache'=>array( 'class'=>'system.caching.CDummyCache', ),

Q: I still got errors !

A: Try to add this in your config/main.php:

'session' => array( 'sessionName' => 'SiteSession', 'class' => 'CHttpSession', 'autoStart' => true, ),

#16187 report it
Vankata at 2014/01/27 04:29am
is it possible ban user by ip address?

is it possible ban user by ip address? And how implement this option?

#16047 report it
ziii at 2014/01/14 10:43am
How do you change redirectUrl after successfull login

Am trying to redirect user to a new controller but the module is set to redirect to site/index i have change all the parameters in the UserModule for redirection but still nothing happens

#15563 report it
zabaleta10 at 2013/11/21 10:17am
errror 404

where is tutorial ? i was follow installation instruction in folder docs

result is error 404

how to resolve ?

#15103 report it
logos010 at 2013/10/07 11:52pm
How to allow controller without login

Hi, can YUM allow me to config a controller/action that allow me to access without auth, because I wana run a crontab, but the code is inside the YumUserController, can I do that, everytime I execute that action without login?

#15072 report it
darioo at 2013/10/04 05:22pm
Module vs core user

I'm using yii-user module. And one thing that is not quite understandable to me is UserIdentity.php When I call

Yii::app()->user->getId()

I get the right user ID. Before this module I used core way of logging in. and with the same code I got the right user ID. But what bugging me is: why now that code takes information from module (I removed old way of logging in). It is the same line of code and it knows that it has to use module. Is it because UserIdentity extends CUserIdentity which is part of yii core?

#14950 report it
johnsnails at 2013/09/24 12:37am
Issue with create / update of user / role etc

Hey,

Every thing seems to be fine in terms of viewing the default info, but cannot update or create new users/roles etc. Page is not loading properly, anyone see anything like this?Role Create Error

I have also tried with an earlier version of the Yii framework, but seems to have the same issue.

As noted further down this page there is at least one fairly obvious error. With the spelling of the word echo. http://www.yiiframework.com/extension/yii-user-management/#c12667

#14884 report it
yiibeginer at 2013/09/18 06:36am
Caching not working

Resolved:

I had added "cache" under "user" but now added under "components" section and it's working fine.

6.) Make sure to set a caching component in your application components section. Yum relies on it. If you do not want to use a cache, add

'components' => array(
        'cache' => array('class' => 'system.caching.CDummyCache'),

inside the components section of your config/main.php.

I am following to this step and stuck with lots or error

Property "YumWebUser.cache" is not defined.__

I have set 'cache' => array('class' => 'system.caching.CDummyCache') in config/main.php file as stated in install_tutorial.txt file but could not succeeded.

Can anybody help me for this?

#14591 report it
Sanjeev at 2013/08/26 08:56am
Not work for me

Hi,thank's for reference but as i want it's don't work....here no any where define how to use translation table in translation or convert multiple language site.? If any reference or guide for same then please let me know.

#14473 report it
haryanto at 2013/08/14 10:45pm
Read docs/Install_tutorial.txt?

Hai jhejhekukuzaizai, you can find it on C:\xampp\htdocs\app_name\protected\modules\user\docs

#14058 report it
jhejhekukuzaizai at 2013/07/16 03:51am
Read docs/Install_tutorial.txt?

Where is it? Where can i find that installation tutorial?

#14029 report it
PrplHaz4 at 2013/07/12 11:34am
Allowing Multiple Social Associations

The common pattern for using social login is to allow users to use multiple providers for authentication - which should have a separate table for storing associations.

This would be the table that login should reference as well, by provider and provider_identifier - to avoid the security issue identified by @Ne0nx3r0.

See hybridauth yii-ext for an example.

#14024 report it
thyseus at 2013/07/12 08:54am
@Ne0nx3r0

Thanks for reporting this critical security problem! I will fix it as soon as possible !

Leave a comment

Please to leave your comment.

Create extension