[Module] Yii User Management Module Discussion, Bug Reports and Feature Requests for the User Management
#1
Posted 01 March 2010 - 01:26 PM
In order to use this Module, please be sure to use the latest development Snapshot of yii or at least yii-1.1.1 (to be released).
It will not work with the stable yii-1.1. (Only with a few Workarounds)
I have just released this Tutorial for installing the User Management Module under a fresh installed Skeleton Application generated by yiic.
Cookbook Page for a Tutorial of installing Yii-User-Management under a fresh Application skeleton (68)
Please test my freshly released Version 0.2 of this Module and give me all sort of feedback
(Bug Reports, Feature Requests, and so on)
many thanks to the yii-user Module which was the codebase for this Module. As far as i know it gets developed in parallel to this
Module. We should modularize and merge our features soon.
Also take a look at grbac !
last but not least: enjoi!
#2
Posted 02 March 2010 - 12:49 AM
the insert statement in line 136 is missing fields for "about" and "street". They were set as NOT NULL in the create statement
#3
Posted 02 March 2010 - 02:53 AM
http://code.google.c...ser-management/
#4
Posted 02 March 2010 - 07:28 AM
In your walkthrough, along with the change to the 'login' link, you might also want to change the logout link in /views/layouts/main.php but it works regardless.
Great extension.
Edit:
In /modules/views/layouts/column2.php I added the following to prevent the display of the empty 'operations' menu header when not logged in.
if (!Yii::app()->user->isGuest) {
$this->beginWidget('zii.widgets.CPortlet', array(
....
}
#5
Posted 03 March 2010 - 01:51 AM
#6
Posted 03 March 2010 - 01:53 AM
jherstein, on 03 March 2010 - 01:51 AM, said:
To clarify quickly, if I go to the URL http://localhost/yii...hp/user/install it takes me to the standard Yii app home page...
#7
Posted 03 March 2010 - 06:02 AM
jherstein, on 03 March 2010 - 01:53 AM, said:
Please try http://localhost/yii...er/user/install
(ModuleID/ControllerID/actionID).
#8
Posted 03 March 2010 - 06:07 AM
// uncomment the following to enable URLs in path-format
this enables to use index.php/user/install instead of index.php?r=user/install
i think this will become the default in the near future, so i didn't wrote this step in my tutorial.
the route 'user/install' already calls the user-module. Install is the action of the default Controller. This is why you don't need to use user/user/install. But you can, if you want.
all other bugs have been collected and will be fixed in the next version.
i will also implement a 'who has watched your profile' and a 'profile guestbook' where guestbook entries can be moderated by the profile owner in the next version.
If anyone wants to contribute to this project with some submodules or something, i can give access to the svn repository to everyone interested. Thank you.
#9
Posted 03 March 2010 - 12:19 PM
thyseus, on 03 March 2010 - 06:07 AM, said:
// uncomment the following to enable URLs in path-format
this enables to use index.php/user/install instead of index.php?r=user/install
i think this will become the default in the near future, so i didn't wrote this step in my tutorial.
the route 'user/install' already calls the user-module. Install is the action of the default Controller. This is why you don't need to use user/user/install. But you can, if you want.
all other bugs have been collected and will be fixed in the next version.
i will also implement a 'who has watched your profile' and a 'profile guestbook' where guestbook entries can be moderated by the profile owner in the next version.
If anyone wants to contribute to this project with some submodules or something, i can give access to the svn repository to everyone interested. Thank you.
Hmmm. I tried this URL also (http://localhost/yii...?r=user/install) and it still doesn't launch the install page. Does the install just setup the DB tables? If so, do you have a SQL script I could try instead?
#10
Posted 03 March 2010 - 01:02 PM
jherstein, on 03 March 2010 - 12:19 PM, said:
probably your config
If you can post it I'll have a quick look

#11
Posted 03 March 2010 - 01:38 PM
'urlManager'=>array(
'urlFormat'=>'path',
),
now the http://localhost/you...hp/user/install works fine
#12
Posted 03 March 2010 - 11:39 PM
My config.php looks like this. Any suggestions warmly welcomed!
<?php
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'JPIM',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),
// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
'loginUrl' => array('user/user/login'),
),
/* JSH: Added code to use User module for security */
'User'=>array(
'class' => 'User',
),
/*
'db'=>array(
'connectionString' => 'sqlite:protected/data/testdrive.db',
),
*/
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=192.168.1.98;dbname=xxxx;port=8889',
'emulatePrepare' => true,
'username' => 'xxxx',
'password' => 'xxxx',
'charset' => 'utf8',
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'example@gmail.com',
),
'modules' => array(
'user' => array(
'debug' => true)
),
/* JSH this raises error: Property "CWebApplication.urlManager" is read only, so have commented this out!
'urlManager' => array(
'urlFormat'=>'path',
),
*/
);
#13
Posted 05 March 2010 - 01:02 AM
<?php if( Yii::app()->User->hasRole( 'SALES' ) ) { echo 'Role is correct!'; } else { echo 'ERROR!'; } ?>
It produced an error:
include(User.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
Anyone can help?
#14
Posted 05 March 2010 - 02:48 AM
include(User.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
Should I also copy User.php from the module/user to model/ ? I only copy the UserIdentity from module/user to component/
This is very good module that I am looking for a long time.....
Daniel, on 05 March 2010 - 01:02 AM, said:
<?php if( Yii::app()->User->hasRole( 'SALES' ) ) { echo 'Role is correct!'; } else { echo 'ERROR!'; } ?>
It produced an error:
include(User.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
Anyone can help?
#15
Posted 05 March 2010 - 10:22 PM
I set up several roles, and when I went to update users there was a field that (I assumed...) you selected roles for that user. I highlighted the roles, hit save, and I get:
This User belongs to this roles:
None
So - for starters, does a user belong to a role, or can a user have several roles, and why doesn't it update with my selections???
BTW, I thought your setup tutorial was excellent - maybe a usage tutorial along those same lines would help people once they get it installed....
I set up a directory and grabbed the snapshot just to try this and compare to SRBAC, which I have on a straight 1.1 setup. That was much harder to set up than your system, especially from the documentation standpoint. However, I have SRBAC functioning and don't have this working - only installed - yet....
#16
Posted 06 March 2010 - 04:22 AM
outrage, on 02 March 2010 - 07:28 AM, said:
In your walkthrough, along with the change to the 'login' link, you might also want to change the logout link in /views/layouts/main.php but it works regardless.
Great extension.
Edit:
In /modules/views/layouts/column2.php I added the following to prevent the display of the empty 'operations' menu header when not logged in.
if (!Yii::app()->user->isGuest) {
$this->beginWidget('zii.widgets.CPortlet', array(
....
}I think better below:
if (!empty($this->menu)) {
$this->beginWidget('zii.widgets.CPortlet', array(
....
}
#17
Posted 07 March 2010 - 04:53 AM
The Addition to the column2.php has been added in svn
@Michael Sullivan:
This will be fixed in the yii-user0.3 version. User and Role indeed have MANY_MANY Relation. As a workaround just replace the relation 'users' in models/Roles.php from (user,role) to (role,user), so everything works. Or use my svn trunk/. Or wait for user0.3
One can use the Google Code Issue tracker or, if someone wants to, can help develop this module. I like the Google Code SVN thing, and this module can grow large and stable with some more volunteer help.
@Daniel:
also fixed in svn. it's Users rather than User - my mistake
#19
Posted 08 March 2010 - 06:17 AM
Yii-User 0.3 gets released today. SVN is available here: http://code.google.c...ser-management/
I have fixed the whole Role-Check routine. Now one can use this syntax:
if(User::hasRole('role'))
{
// user is allowed
}
else
{
// user is not allowed to do this
}
When Updating to 0.3 please make sure to copy over the components/Useridentity.php again, since there was important code changed (or reinstall to make sure everything works)
It's important to add this line to your application configuration:
'import'=>array( 'application.modules.user.models.*',
i have updated the Cookbook Page and the Documentation included with the yii-user package under docs/
I hope that this will now work for you!!
If anyone has a better idea on how the Access of the actual User can be checked, please give me an hint. Further polishing of messages are already in svn onwards to 0.4. I'm interested in a high quality module
@jherstein:
i would like to know if the route problems are solved in user0.3. Please always use the latest yii1.1-dev.
#20
Posted 14 March 2010 - 09:37 AM
Changelog:
- One can use User::hasRole(array('role1', 'role2')) to check if the User belongs to role 1 OR role 2 (thyseus)
- Rearranged Menu Items more logical (thyseus)
- Much more strict OOP Design (thyseus)
- UserIdentity.php no longer needs to be copied (zephca)
- Created WebUser class to tie in the cookie based user management features to the DB. (zephca)
- Fixed some references to unset objects (zephca)
- Changed directory permissions to 755 and file permissions to 644 so it works better with Git source control (zephca)
- User can log in by username, E-Mail or both depending on loginType (thyseus)
- Added possibility to set up Roles in User form and Users in Role form (thyseus)

Help














