accessRules not from users table. How?

Hello community!

I just start learning yii with my own project.

The idea is to manage birthday parties with invited people and let them participate in expensive presents as a part. (for example one fкiend cannot afford to buy iPad2 for present, but five friend can! ;))

I already made this project using PHP with no any Framework and DB. And it worked well for my birthday! (Now I have 2 iPads :D)

Registered user creates and event (title, date, invitation_text)

Then user adds to this event members (name, tel, email, unique_string) and wishlist(title, description, url, price)

Then script will loop through invited people and send e-mail with links to their invitations.

Invitation text will contain variables that will be changed to values from database.


Dear %FirstName%,


You are invited ... 

The idea of unique_string is to refer member to its record without login and auth procedures.

For example: Freind will receive by email link to his invitation


http : //somehost(dot)com/invitation/index.php?r=invitation/view&unique_string=344kjs8

So the script should remember in cookies this string and let this member to accept or decline invitation, see wishlist of the party he is invited to and other invited people list, express his willing to participane in one of the gifts.

unique_string will identify the member and limit his scope to related party, then to other object related to this party.

So the question is how to make accessRules based on the unique_string?

just use the primary key field(id field) on your database table

it will be the number you would call in:

$model=Invitation::model()->findByPk($id);