Yii Framework Forum: Auth Extension - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Auth Extension Issue with custom primary key Rate Topic: -----

#1 User is offline   Peter @ Liverpool 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 17-March 12

Posted 30 December 2012 - 12:24 PM

Hi, attached is the output of the error I have after installing the extension "auth" developed by Chris83. I specified the parameters for the configuration in the module definition array - I am not clear whether that is correct. I have a CompanyContact table instead of Users and it's primary key is company_contact_id. I've set this as the comments suggest, but it throws an error.

Property "CompanyContact.id" is not defined. 
(see attached file for full stack trace)

'modules'=>array(
'auth' => array(
          'strictMode' => true, // when enabled authorization items cannot be assigned children of the same type.
          'users' => array('admin'), // a list of users who has access to the module.
          'userClass' => 'CompanyContact', // the name of the user model class.
          'userIdColumn' => 'company_contact_id', // the name of the user id column.
          'userNameColumn' => 'username', // the name of the user name column.
          'appLayout' => 'application.views.layouts.main', // the layout used by the module.
          'viewDir' => null, // the path to view files to use with this module.
        ),
)

Attached File(s)


0

#2 User is offline   Peter @ Liverpool 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 17-March 12

Posted 01 January 2013 - 12:13 PM

Hi all, I have solved this by making the following change to the Extension class:

I had to change line 35 in class AuthAssignmentItemsColumn

from:
_$assignments = $am->loadAuthAssignments($data->id, false);_

to:
_$assignments = $am->loadAuthAssignments($data->primaryKey(), false);_

in order to use a custom "User" model with a primary key other than the standard "id". Chris83 had implemented this scenario but left this line unchanged.
0

#3 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 02 January 2013 - 04:00 AM

This issue has been fixed in version 1.2.1. Sorry for the inconvenience.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#4 User is offline   Peter @ Liverpool 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 17-March 12

Posted 02 January 2013 - 01:14 PM

Many thanks for the fast fix.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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