sarvan75 / yii-user-management

Automatically exported from code.google.com/p/yii-user-management
0 stars 0 forks source link

Add a getRoles() to YumWebUser.php #87

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
    /**
     * Returns the roles assigned to this user
     */
    public function getRoles($uid = 0) {
        $roles = '';

        if($uid == 0)
            $uid = Yii::app()->user->id;

        $user = YumUser::model()->findByPk($uid);
        foreach($user->roles as $role)
            $roles .= ' ' . $role->title;

        return $roles;
    }

Original issue reported on code.google.com by N.Brandi...@gmail.com on 16 Sep 2010 at 7:10

GoogleCodeExporter commented 9 years ago
Changing the line:

$roles .= ' ' . $role->title;

to

$roles[] = $role->title;

results in an array being returned which may be more useful.

Original comment by N.Brandi...@gmail.com on 16 Sep 2010 at 7:47

GoogleCodeExporter commented 9 years ago
you are right. we use the getRoles() function for the CGridView of
user/admin so we need to change the displaying there, too. i will
do this change in one of the next commits. thanks for that hint.

Original comment by thyseus on 19 Sep 2010 at 9:16

GoogleCodeExporter commented 9 years ago
user/views/role/_form.php the title input specification has a max length of 20. 
 the associated database has a length of varchar 255.  perhaps the _form.php 
should have a maxlengh of 255 also.

Original comment by N.Brandi...@gmail.com on 19 Sep 2010 at 12:10

GoogleCodeExporter commented 9 years ago

Original comment by thyseus on 17 Dec 2010 at 3:45