Yii Framework Forum: [Module] Yii User Management Module - Yii Framework Forum

Jump to content

  • (30 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[Module] Yii User Management Module Discussion, Bug Reports and Feature Requests for the User Management Rate Topic: ***** 5 Votes

#1 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 01 March 2010 - 01:26 PM

This is the forum thread for the Yii User Management Module

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!
1

#2 User is offline   AdrianC 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-March 10

Posted 02 March 2010 - 12:49 AM

found a bug for version 0.2 after fixing "public $menu=array();".
the insert statement in line 136 is missing fields for "about" and "street". They were set as NOT NULL in the create statement
0

#3 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 02 March 2010 - 02:53 AM

bug is fixed in svn. svn and issue tracker is available here:

http://code.google.c...ser-management/
0

#4 User is offline   outrage 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 313
  • Joined: 10-November 09
  • Location:Blackpool, United Kingdom

Posted 02 March 2010 - 07:28 AM

Updated to the latest svn and it's looking good :)

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(
    ....
}

0

#5 User is offline   jherstein 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 03-March 10

Posted 03 March 2010 - 01:51 AM

I'm a newbie to Yii. I have a simple app up and running, just pulling data from one table right now. I followed the steps for this UMM, but the /user/install doesn't seem to do anything, so I can't actually do the install process. Basically, i put the URL in and get no response, although the rest of my site works. ANy idea how I debug this? I really want to check out this extension!
0

#6 User is offline   jherstein 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 03-March 10

Posted 03 March 2010 - 01:53 AM

View Postjherstein, on 03 March 2010 - 01:51 AM, said:

I'm a newbie to Yii. I have a simple app up and running, just pulling data from one table right now. I followed the steps for this UMM, but the /user/install doesn't seem to do anything, so I can't actually do the install process. Basically, i put the URL in and get no response, although the rest of my site works. ANy idea how I debug this? I really want to check out this extension!


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...
0

#7 User is offline   Iggi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 28-February 10

Posted 03 March 2010 - 06:02 AM

View Postjherstein, on 03 March 2010 - 01:53 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...


Please try http://localhost/yii...er/user/install
(ModuleID/ControllerID/actionID).
0

#8 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 03 March 2010 - 06:07 AM

Please take a look in your protected/config/main.php. Activate your Url Manager by removing the Comments at

// 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.
0

#9 User is offline   jherstein 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 03-March 10

Posted 03 March 2010 - 12:19 PM

View Postthyseus, on 03 March 2010 - 06:07 AM, said:

Please take a look in your protected/config/main.php. Activate your Url Manager by removing the Comments at

// 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?
0

#10 User is offline   Seal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 126
  • Joined: 02-February 10

Posted 03 March 2010 - 01:02 PM

View Postjherstein, on 03 March 2010 - 12:19 PM, said:

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?


probably your config

If you can post it I'll have a quick look
Sylvester La-Tunje

Posted Image
0

#11 User is offline   piwer 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 04-April 09

Posted 03 March 2010 - 01:38 PM

i think standard shell created yii app has NO url-manager in default. so one has to add to main.php config file this (in components section):
'urlManager'=>array(
    'urlFormat'=>'path',
),

now the http://localhost/you...hp/user/install works fine
0

#12 User is offline   jherstein 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 03-March 10

Posted 03 March 2010 - 11:39 PM

I've tried a few of these suggestions. I still can't get /user/user/install to work, so have been using index.php?r=user/user/install. I think I am getting closer; the page now reads 'The system is unable to find the requested action "install".'

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',
),
*/

);
0

#13 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 26-September 09

Posted 05 March 2010 - 01:02 AM

I am on Yii 1.1 stable. With few workaround I could install user management module. However, i had trouble to use it, in my application, I wrote a simple example like this

<?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?
0

#14 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 26-September 09

Posted 05 March 2010 - 02:48 AM

I also tried with Yii 1.1 dev, resulting in the same error message

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.....

View PostDaniel, on 05 March 2010 - 01:02 AM, said:

I am on Yii 1.1 stable. With few workaround I could install user management module. However, i had trouble to use it, in my application, I wrote a simple example like this

<?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?

0

#15 User is offline   Michael Sullivan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 06-February 10

Posted 05 March 2010 - 10:22 PM

Hi I set up up Yii User Management Module today and was able to get it installed but have some issues / question regarding usage....

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....
0

#16 User is offline   ginus 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 29-January 10

Posted 06 March 2010 - 04:22 AM

View Postoutrage, on 02 March 2010 - 07:28 AM, said:

Updated to the latest svn and it's looking good :)

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(
    ....
}

0

#17 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 07 March 2010 - 04:53 AM

I recently had some Problems with the yii route generator, too. I am trying to fix these issues in the yii-user 0.3 which will be released soon and addresses many of the Problems reported by users (thank you)

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 ;)
0

#18 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 26-September 09

Posted 07 March 2010 - 11:57 PM

View Postthyseus, on 07 March 2010 - 04:53 AM, said:

@Daniel:

also fixed in svn. it's Users rather than User - my mistake ;)



Thanks for the reply thyseus, but I do not quite understand which one should be changed to Users? Where can I get the code from SVN?

Once again, many thanks.
0

#19 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 08 March 2010 - 06:17 AM

@Daniel:

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 ;) Anyone wants to translate messages in yii-user-management?

@jherstein:

i would like to know if the route problems are solved in user0.3. Please always use the latest yii1.1-dev.
0

#20 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 14 March 2010 - 09:37 AM

Yii User 0.4 is released.

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)
0

Share this topic:


  • (30 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users