StanfordHCI/foundry — pull request #136 by dretelny (2014-12-05 23:48:02+00:00)
Title: Dr membertypefix

This PR fixes two issues:

1) the issue causing the member type not to get saved unless you press save on the popover. Specifically, because we changed the way we add members such that you just type the role and press enter (i.e. the popover doesn't load), the save button doesn't get clicked initially and therefore the member type was not getting saved (the member type by default should be worker since you can only change the role to a PC or client by opening the popover and saving your changes).

2) because the member type was not getting set, there were also issues with workers still being able to access the worker panels. I uncovered a several problems with how i was checking the member type and basically wrote the valid_user method in the application.rb controller. when testing, make sure that only authors, project coordinators and clients can access the panels and that workers cannot.

When testing:
1) add worker(s) to your team but don't open the member popover
2) open the worker view for this worker and make sure the memberType is saving (you can do this my typing "memberType" in your console or by typing "current_user" in your console --> they should both save worker
3) Try to access the panels by going to localhost:3000/workers/index
4) Try accessing the panels via the project specific hire link (you would need to get the link via the hire button in either pc/client or author view)