I’ve not used permissions, but since no one else is here I’ll try to help. It looks like you might call
Yii::app()->user->can('actionName');
Incidentally, I had a difficult time with the unit tests shipped with YUM. Since I find it easier to explore how things work with unit tests, I struggled with this a bit. I found that adding
I have installed yii user management module, and its working fine,
I am able to register, send activation mail and activate account.
However, I tried to set the firstVisit Parameter in User.module to the membership order page. But when I login for the first time after activating my account, I am still getting redirected to the home page, rather than the membership page.
I was trying to trace it from the YumAuthController redirect function, by adding logs:
public function redirectUser($user) {
Yii::log('----------Redirecting User---');
$user->lastvisit = time();
$user->save(true, array('lastvisit'));
Yii::log('----------set last visit time ---');
Yii::app()->user->setState('first_login', true);
Yii::log('----------set state first login ---');
if(isset($_POST) && isset($_POST['returnUrl']))
$this->redirect(array($_POST['returnUrl']));
Yii::log('----------return url test for admin ---');
if ($user->superuser && Yum::module()->returnAdminUrl)
$this->redirect(Yum::module()->returnAdminUrl);
Yii::log('----------return url test for user ---');
if(isset(Yii::app()->user->returnUrl))
$this->redirect(Yii::app()->user->returnUrl);
Yii::log('----------pwd expired---');
if ($user->isPasswordExpired())
$this->redirect(array('passwordexpired'));
Yii::log('----------return url not set for user ---');
if (Yum::module()->returnUrl !== '')
$this->redirect(Yum::module()->returnUrl);
else
$this->redirect(Yii::app()->user->returnUrl);
Yii::log('----------now redirect to first vist---');
$this->redirect(Yum::module()->firstVisitUrl);
}
The trace file shows the following trace:
2013/05/25 17:50:23 [info] [application] ----------Redirecting User---
2013/05/25 17:50:23 [trace] [system.caching.CFileCache] Serving "yum_translations_en_us_yum" from cache
2013/05/25 17:50:23 [trace] [system.caching.CFileCache] Serving "yum_translations_en_us_yum" from cache
2013/05/25 17:50:23 [trace] [system.caching.CFileCache] Serving "yum_translations_en_us_yum" from cache
2013/05/25 17:50:23 [trace] [system.base.CModule] Loading "avatar" module
2013/05/25 17:50:23 [trace] [system.db.ar.CActiveRecord] YumUser.update()
2013/05/25 17:50:23 [trace] [system.db.ar.CActiveRecord] YumUser.updateByPk()
2013/05/25 17:50:23 [trace] [system.db.CDbCommand] Executing SQL: UPDATE `user` SET `lastvisit`=:yp0 WHERE `user`.`id`='21'
2013/05/25 17:50:23 [trace] [system.base.CModule] Loading "profile" module
2013/05/25 17:50:23 [trace] [system.db.CDbCommand] Querying SQL: SHOW COLUMNS FROM `privacysetting`
2013/05/25 17:50:23 [trace] [system.db.CDbCommand] Querying SQL: SHOW CREATE TABLE `privacysetting`
2013/05/25 17:50:23 [trace] [system.db.ar.CActiveRecord] YumPrivacysetting.findByPk()
2013/05/25 17:50:23 [trace] [system.db.CDbCommand] Querying SQL: SELECT * FROM `privacysetting` `t` WHERE `t`.`user_id`='21' LIMIT 1
2013/05/25 17:50:23 [trace] [system.db.ar.CActiveRecord] writing MANY_MANY data for YumUser
2013/05/25 17:50:23 [trace] [system.caching.CFileCache] Serving "yum_user_relations" from cache
2013/05/25 17:50:23 [info] [application] ----------set last visit time ---
2013/05/25 17:50:23 [info] [application] ----------set state first login ---
2013/05/25 17:50:23 [info] [application] ----------return url test for admin ---
2013/05/25 17:50:23 [info] [application] ----------return url test for user ---
Please let me know why am I not able to transfer to the membership page.
Hi, when install on default modules application folder i got yii user module work out.
But when i try to install to common/lib/vendor/
i got
CException
Property "YumWebUser.0" is not defined.
yiisoft\yii\framework\web\auth\CWebUser.php(160)
public function __set($name,$value)
{
if($this->hasState($name))
$this->setState($name,$value);
else
parent::__set($name,$value);
}
I downloaded the package from Github as a ZIP file and implemented it, but got error message below when click ‘Privacy Setting’. Should I download the r0.8 from here?
include(YumProfileField.php): failed to open stream: No such file or directory
I completed the installation of Yii User management Module. Now I Can login as admin/admin, but can not see anyway to extend user/profile fields as there is no profile_field table created.