Yii Framework Forum: No user is attached to project on creation - Yii Framework Forum

Jump to content

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

No user is attached to project on creation

#1 User is offline   Benn 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 47
  • Joined: 16-January 11
  • Location:Paris

Posted 11 February 2011 - 07:10 PM

Hello,

When I create a project, the creating user is not attached to the project, which means I can't add new users to the project (since the "add user" operation isn't available.
Did I miss something?
0

#2 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 11 February 2011 - 07:38 PM

You should see an "Add User To Project" link in the right column "Operations" list when viewing the details of a project you created as shown on the attached image. Are you saying you are not seeing this?

How far along in the book (what chapter) are you?

Attached File(s)


0

#3 User is offline   Benn 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 47
  • Joined: 16-January 11
  • Location:Paris

Posted 11 February 2011 - 08:30 PM

I'm on chapter 10. But actually, even if i use the files from chapter 13 from the zip downloaded from the editor's site, i get the same results.
I don't have the added user to project once the project is created.
What part of the code associates the creating user to the new project?
Thanks
0

#4 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 11 February 2011 - 10:09 PM

There is not any code implemented that automatically associates the user who created the project as the "owner" of that project. Of course it makes perfect sense to do that, and it would make for a good addition to the application.

The answer to your question as to how to add a user at all is to be sure you are logged in as the "admin" user (aka 'super' user) that is introduced in Chapter 12 and the explicit assignment of user #1 (i.e. id=1) to this new role is on page 296 of the printed book. That user will have access and the link should display.

The project CRUD was introduced several chapters prior to user management and RBAC. In chapter 8 (pages 202-213) we are moving very quickly through the implementation of adding users to projects. On page 210, we show the add new user to project form before we implement the access check for RBAC to ensure proper permission. At that point, any user would be able to add a new user to a project, but once we wrap the display of the link (and the extra checkAccess() call in the actionAddUser() method), then it will restrict access to just those users who have been assigned the "createUser" permission. And, as you have pointed, out, we did not go back and alter the Project creation code (introduced several chapters prior) to ensure the user doing the project creation was automatically added as an "admin" for that project.

The book is attempting to cover a great many topics, and there were many constraints that would not allow all details of a fully completed application to be explicitly covered. The result is that there are many aspects of the TrackStar application that are left up to the reader to implement. My hope, however, is that the book exposes you to enough of the meaningful details to make it easy for you to fill-in some of these blanks.
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