X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/b4be5795ddbcef63b4b6fffb200c3dfc3ffcb530..ce2ddc553c3e30ffaa62d6e0f2e1220ca7f63f34:/WEB-INF/lib/ttRegistrator.class.php diff --git a/WEB-INF/lib/ttRegistrator.class.php b/WEB-INF/lib/ttRegistrator.class.php index b3551dad..c206881d 100644 --- a/WEB-INF/lib/ttRegistrator.class.php +++ b/WEB-INF/lib/ttRegistrator.class.php @@ -84,11 +84,14 @@ class ttRegistrator { if ($this->err->yes()) return false; // There are errors, do not proceed. global $i18n; - - // Protection fom too many recent bot registrations from user IP. - if ($this->registeredRecently()) { - $this->err->add($i18n->get('error.access_denied')); - return false; + global $user; + + // Protection from too many recent bot registrations from user IP. + if (!$user->can('administer_site')) { // No problems for site admin. + if ($this->registeredRecently()) { + $this->err->add($i18n->get('error.access_denied')); + return false; + } } import('ttUserHelper'); @@ -118,7 +121,9 @@ class ttRegistrator { return false; } - if (!$this->setCreatedBy($this->user_id)) + // Set created_by appropriately (admin or self). + $created_by = $user->can('administer_site') ? $user->id : $this->user_id; + if (!$this->setCreatedBy($created_by)) return false; return true; @@ -186,7 +191,7 @@ class ttRegistrator { } // Update top manager. - $sql = "update tt_users set created_by = $user_id where id = $user_id and group_id = $this->group_id"; + $sql = "update tt_users set created_by = $user_id where id = $this->user_id and group_id = $this->group_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) { $this->err->add($i18n->get('error.db'));