Author: Jonathan.Wage
Date: 2010-02-10 17:44:24 +0100 (Wed, 10 Feb 2010)
New Revision: 27829
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUserPlugin/modules/sympal_users/lib/Basesympal_usersActions.class.php
Log:
[1.4][sfSympalPlugin][1.0] Disallowing the deleting of yourself as a logged in
user to avoid locking yourself out of Sympal
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUserPlugin/modules/sympal_users/lib/Basesympal_usersActions.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUserPlugin/modules/sympal_users/lib/Basesympal_usersActions.class.php
2010-02-10 16:39:28 UTC (rev 27828)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalUserPlugin/modules/sympal_users/lib/Basesympal_usersActions.class.php
2010-02-10 16:44:24 UTC (rev 27829)
@@ -5,4 +5,19 @@
class Basesympal_usersActions extends autosympal_usersActions
{
+ public function preExecute()
+ {
+ parent::preExecute();
+
+ $this->getContext()->getEventDispatcher()->connect('admin.delete_object',
array($this, 'listenToAdminDeleteObject'));
+ }
+
+ public function listenToAdminDeleteObject(sfEvent $event)
+ {
+ if ($this->getUser()->getGuardUser()->getId() == $event['object']->getId())
+ {
+ $this->getUser()->setFlash('error', 'You cannot delete yourself from the
database!');
+ $this->redirect('@sympal_users');
+ }
+ }
}
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" 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/symfony-svn?hl=en.