CakePHP: Scaffolding after having written edit/view/add
I have an application in which we give a very friendly interface for
managing data. This is done through many controllers' add/edit/view
functions. But now the requirement has come that we should have "super
admins" able to edit anything, and scaffolding will give them a quick and
dirty manner of changing data. Since scaffolding uses add/edit/view by
default, I've unintentionally overwritten the ability to scaffold.
I can't just go and change all my calls to edit/add for our "user
friendly" data managing. So I want to essentially ignore the add/edit/view
when, for example, a user has a flag of "yes, please let me scaffold". I
imagined it would be something like:
public function edit($id) {
if (admin_user) {
$scaffold;
} else {
[user-friendly version code]
}
}
But no dice. How can I achieve what I want?
No comments:
Post a Comment