From b3211cb2a8282556d410c91771baeb764d47ed10 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 7 Oct 2009 20:26:26 -0700 Subject: Change the users.php controller so its no longer restful. The problem with our approach to restfulness is that it assumes that the resource will be found in the gallery database. It may well be there, but in the case of using plugable drivers from users, it could be in a ldap directory, it could be the gallery3 database, but the model could be wrapped in a control structure. So it was just easier to remove the restfulness and just call user::lookup instead. --- modules/gallery/controllers/users.php | 9 +++++---- modules/gallery/helpers/user.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/gallery/controllers/users.php b/modules/gallery/controllers/users.php index 4ad704f0..07c5a457 100644 --- a/modules/gallery/controllers/users.php +++ b/modules/gallery/controllers/users.php @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Users_Controller extends REST_Controller { - protected $resource_type = "user"; +class Users_Controller extends Controller { + public function update($id) { + $user = user::lookup($id); - public function _update($user) { if ($user->guest || $user->id != user::active()->id) { access::forbidden(); } @@ -57,7 +57,8 @@ class Users_Controller extends REST_Controller { } } - public function _form_edit($user) { + public function form_edit($id) { + $user = user::lookup($id); if ($user->guest || $user->id != user::active()->id) { access::forbidden(); } diff --git a/modules/gallery/helpers/user.php b/modules/gallery/helpers/user.php index f148f720..abbf8ab0 100644 --- a/modules/gallery/helpers/user.php +++ b/modules/gallery/helpers/user.php @@ -25,7 +25,7 @@ */ class user_Core { static function get_edit_form($user) { - $form = new Forge("users/$user->id?_method=put", "", "post", array("id" => "g-edit-user-form")); + $form = new Forge("users/update/$user->id", "", "post", array("id" => "g-edit-user-form")); $form->set_attr("class", "g-narrow"); $group = $form->group("edit_user")->label(t("Edit User: %name", array("name" => $user->name))); $group->input("full_name")->label(t("Full Name"))->id("g-fullname")->value($user->full_name); -- cgit v1.2.3