Matthew Ratzloff wrote:
Controllers
-----------------------
These classes have indexAction(), createAction(), updateAction(),
viewAction(), saveAction(), deleteAction(), etc. Some people prefer these
names to be plural.
- StudentController
- ProfessorController
- ClassController
- OrganizationController
Some possible URLs:
/professor
Display all professors; routes to /professor/view
/professo/view/23
Display a single professor (can use something other than numeric ID)
/student/view/gender/female
Display all female students
/student/view/3452332
Display a single student
For things like roll calls, I would have professors and organizations log
in, then the relevant URLs would be:
/organization/rollcall
/class/rollcall/17393
Just some ideas. There are a several right ways to do it, and many, many
wrong ways. ;-)
I completely agree with you on these. These urls are indeed clean, and
I would consider them 'right'. Let me add one simple stipulataion, and
perhaps Matt could chime in.
What if I wanted to limit the ability to Creating/Updating/Deleting to a
certain group of people (Access Control / admin type) and I wanted
funnel this through a super-controller. Is that possible, is this a
correct method? For example:
I want to disallow direct controllers like /student/ , or /professor/ or
/class/. And I want to delegate, (while doing certain access control
checks and variable/param setting) inside some super controller named
DataEntryController, and openly allow ReportController.
I plan these urls to be
/data_entry/student/view/1
/data_entry/class/class_name/CS101
/data_entry/professor/delete/2342332
I anticipate (DataEntryController would do certain checks, then pass on
to the controller described in the url at pos #2, for example
DataEntryController -> StudentController, or DataEntryController ->
ProfessorController.
Furthermore, my more open path would be
/report/class/rollcall
/report/student/view/id (no write access clearly)
/report/organization/rollcall
/report/student/list/gender/female
etc.
I would anticipate paths/routes to be ReportController -> StudentController
Is this a 'correct' approach? Also, how might this be done with the new
controller? How do we describe this technique of Organizing, or
creating these virtual collections of controllers (from the perspective
of the user). Is this what we would call 'stacking controllers'?
Matthew, I cc' you since you would be the foremost expert on this subject ;)
-Ralph