Fix the valid_admin code -- it was considering all non-admins invalid.

Fixes ticket #997 (highest prime under 1000!)
This commit is contained in:
Bharat Mediratta
2010-01-30 16:20:44 -08:00
parent dccb2b73ff
commit 69897b4c66
+2 -1
View File
@@ -148,7 +148,8 @@ class User_Model extends ORM implements User_Definition {
* Validate the admin bit.
*/
public function valid_admin(Validation $v, $field) {
if ($this->id == identity::active_user()->id && !$this->admin) {
$active = identity::active_user();
if ($this->id == $active->id && $active->admin && !$this->admin) {
$v->add_error("admin", "locked");
}
}