Hello everybody,

This topic is quite similar to
http://groups.google.com/group/cake-php/browse_thread/thread/35900a65ab04ab05/92b6e71a451c35d0?lnk=gst&q=roles
which remains still unresolved.

It's just about a common scenario while building a corporate Intranet.

There is a fine DB and many models with their relationships...
There are also lots of users, and each users belongs to a role.

So the MANAGERS can add/edit/delete everything, but (let's say)
WORKERS can only read/write to some things, and last, CUSTOMERS can
only read a part of the data.

Cake's admin routes are nice, but are designed for a simpler scenario
(Users vs. Admins), so won't help here.

The only thing I can imagin is quite LAME:

class contract_controller extends AppController {

  function _edit_contract_by_laywer($id) {
    ...my_lame_private_method...
  }

  function _edit_contract_by_broker($id) {
    ...my_lame_private_method...
  }

  function _edit_contract_by_manager($id) {
    ...my_lame_private_method...
  }


  function edit($id) {

    if ($role == 'LAYWER') {
      $this->_edit_contract_by_laywer($id);
      $this->render('edit_contract_by_lawyer');
    }
    elseif ($role == 'BROKWER') {
      $this->_edit_contract_by_broker($id);
      $this->render('edit_contract_by_broker');
    }
    elseif ($role == 'MANAGER') {
      $this->_edit_contract_by_manager($id);
      $this->render('edit_contract_by_manager');
    }

  }

}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to