From 7845f0a8a6e0a36303e0fb4c954ada9925b166a3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 22 Sep 2011 00:40:54 -0400 Subject: Finally get around to implementing deleting users. (status=4) --- src/controllers/Users.class.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src/controllers/Users.class.php') diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php index dc89603..d799760 100644 --- a/src/controllers/Users.class.php +++ b/src/controllers/Users.class.php @@ -201,17 +201,13 @@ class Users extends Controller { $config_options = array(); global $mm; $mm->pluginManager()->callHook('userConfig', &$config_options); - + foreach ($config_options as $group=>$options) { foreach ($options as $option) { $this->confText($user, $option[0]); } } - /* - $this->confText($user, 'firstname'); - $this->confText($user, 'lastname'); - $this->confText($user, 'hsclass'); - */ + // Change contact info ///////////////////////////////////////// global $CONTACT_METHODS; foreach ($CONTACT_METHODS as $method) { @@ -300,6 +296,10 @@ class Users extends Controller { $editable = $editable && $logged_in_user->isAdmin(); $value = $user->isAdmin(); break; + case 'auth_delete': + $editable = $editable && $logged_in_user->isAdmin(); + $value = false; + break; default: $value = $user->getConf($key); if ($value===false) $value=''; @@ -325,6 +325,8 @@ class Users extends Controller { case 'auth_admin': $user->setAdmin($value=='true'); break; + case 'auth_delete': + if ($value=='true') $user->delete(); default: $user->setConf($key, $value); break; @@ -335,14 +337,18 @@ class Users extends Controller { return array('key'=>$key, 'name'=>$name); } private function getIndexAttribs() { - $attribs = array($this->attrib('auth_user', 'Active'), - $this->attrib('lastname','Last'), - $this->attrib('firstname','First'), - $this->attrib('hsclass','Class of'), - $this->attrib('phone','Phone number'), - $this->attrib('email','Email'), - $this->attrib('auth_name', 'Username'), - ); + $attribs = array(); + $attribs[] = $this->attrib('auth_user', 'Active'); + if (Auth::getObj(Login::isLoggedIn())->isAdmin()) { + $attribs[] = $this->attrib('auth_admin', 'Admin'); + $attribs[] = $this->attrib('auth_delete', 'Delete'); + } + $attribs[] = $this->attrib('lastname','Last'); + $attribs[] = $this->attrib('firstname','First'); + $attribs[] = $this->attrib('hsclass','Class of'); + $attribs[] = $this->attrib('phone','Phone number'); + $attribs[] = $this->attrib('email','Email'); + $attribs[] = $this->attrib('auth_name', 'Username'); return $attribs; } } -- cgit v1.2.3