Chapter 8: Realtion of project_user_assignment to other tables

Hello,

First of all: Yii is great and this book a very good starting point.

I have just finished Chapter 8 and am now doing the User Authorization Level Checks which are not described in the book, but which the Author leaves to us to do our self.

By looking at the MYSQL, I realized that we do have now three tables where I see in all of them the same:

tbl_project_user_role:

project_id user_id role

tbl_project_user_assignment

project_id user_id

AuthAssignment

itemname userid

The itemname in the AuthAssignment is the role inteh tbl_project_user_role.

The project_ID and user_ID pairs are the same in the two tables tbl_project_user_assignment and tbl_project_user_role.

I do not understand why this is done this way.

If this is done just to make the training easier, than I will of course shut my mouth.

I will also remain silent if this is solved in one of the next chapters anyway.

Thanks for any hints.

gb5256

Sorry-this is answered elsewhere with if{} fix for function verify in projectuserform.php -----please ignore rest of this post---- sorry-- have been trying to work through this portion as well and am wondering if I have the primary key wrong in AuthAssignment? Currently using itemname and userid together as the primary key on mysql AuthAssignment table. Problem is that if you add the same user to more than one project in the same role I then get this:

CDbCommand failed to execute the SQL… Integrity constraint violation… DUPLICATE entry ‘member-6’ for key ‘PRIMARY’… SQL was… Insert into AuthAssignment (item name,userid,biz rule,data) values (:item name,:userid,:biz rule,:data)…

I am not sure how to overcome this other than creating a primary key that incorporates all 3---- userid& item name(aka role)& also project_ID

…but I see from the trackstar database dump on another posting that others are using the primary key as I am. Clearly I am missing something (or are others also having trouble adding a user to more than one project in the same role?)

…any tips greatly appreciated. Thanks, brook