No user is attached to project on creation
Posted 11 February 2011 - 07:10 PM
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?
Posted 11 February 2011 - 07:38 PM
How far along in the book (what chapter) are you?
Number of downloads: 3
Posted 11 February 2011 - 08:30 PM
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?
Posted 11 February 2011 - 10:09 PM
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.