Ignore:
Timestamp:
Nov 2, 2013 11:44:56 PM (11 years ago)
Author:
anonymous
Message:

Removed all usage of 'user_type' from admin management; minor update to module maker.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/services/admins.php

    r408 r432  
    6666$so->setColumn('last_name', $auth->getParam('db_table') . '.last_name ASC', $auth->getParam('db_table') . '.last_name DESC');
    6767$so->setColumn('email', $auth->getParam('db_table') . '.email ASC', $auth->getParam('db_table') . '.email DESC');
    68 $so->setColumn('user_type', $auth->getParam('db_table') . '.user_type ASC', $auth->getParam('db_table') . '.user_type DESC');
    6968$so->setColumn('seconds_online', $auth->getParam('db_table') . '.seconds_online ASC', $auth->getParam('db_table') . '.seconds_online DESC');
    7069$so->setColumn('last_login_datetime', $auth->getParam('db_table') . '.last_login_datetime ASC', $auth->getParam('db_table') . '.last_login_datetime DESC');
     
    230229    }
    231230
    232     if (getFormData('user_type') == 'root' && 'root' != $auth->get('user_type')) {
    233         $fv->addError('user_type', sprintf(_("You do not have clearance to create a user with root privileges."), null));
    234     }
    235 
    236231    $fv->numericRange('admin_id', -32768, 32767, _("<strong>Admin id</strong> must be a valid number between -32768 and 32767."));
    237232
     
    249244    $fv->stringLength('email', 0, 255, _("<strong>Email</strong> must contain less than 256 characters."));
    250245    $fv->validateEmail('email');
    251 
    252     $fv->isEmpty('user_type', _("<strong>User type</strong> cannot be blank."));
    253     $fv->stringLength('user_type', 0, 255, _("<strong>User type</strong> has an invalid selection."));
    254246}
    255247
     
    265257        'last_name' => '',
    266258        'email' => '',
    267         'user_type' => '',
    268259        'seconds_online' => '0',
    269260        'last_login_datetime' => '0000-00-00 00:00:00',
     
    322313        'last_name' => '',
    323314        'email' => '',
    324         'user_type' => '',
    325315        'seconds_online' => '0',
    326316        'last_login_datetime' => '0000-00-00 00:00:00',
     
    362352    // Get the information for this object.
    363353    $qid = $db->query("
    364         SELECT " . $auth->getParam('db_username_column') . ", user_type from " . $auth->getParam('db_table') . "
     354        SELECT " . $auth->getParam('db_username_column') . "
    365355        WHERE " . $auth->getParam('db_primary_key') . " = '" . $db->escapeString($id) . "'
    366356    ");
    367     if (! list($name, $user_type) = mysql_fetch_row($qid)) {
     357    if (! list($name) = mysql_fetch_row($qid)) {
    368358        $app->logMsg('Could not find record with admin_id: ' . $id, LOG_WARNING, __FILE__, __LINE__);
    369359        $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);
     
    374364    $qid = $db->query("SELECT COUNT(*) from " . $auth->getParam('db_table') . "");
    375365    list($num_admins) = mysql_fetch_row($qid);
    376     if ('root' == $user_type && 'root' != $auth->get('user_type')) {
    377         // Only root users can delete root users!
    378         $app->raiseMsg(_("You do not have clearance to delete a root administrator."), MSG_NOTICE, __FILE__, __LINE__);
    379     } else if ($num_admins <= 1) {
     366    if ($num_admins <= 1) {
    380367        // There must always be at least one admnistrator!
    381368        $app->raiseMsg(_("You cannot delete the only administrator in the database. There must be at least one to log in and create other users."), MSG_NOTICE, __FILE__, __LINE__);
     
    410397            last_name,
    411398            email,
    412             user_type,
    413399            added_by_user_id,
    414400            added_datetime
     
    418404            '" . $db->escapeString($frm['last_name']) . "',
    419405            '" . $db->escapeString($frm['email']) . "',
    420             '" . $db->escapeString($frm['user_type']) . "',
    421406            '" . $db->escapeString($auth->get('user_id')) . "',
    422407            NOW()
     
    466451            last_name = '" . $db->escapeString($frm['last_name']) . "',
    467452            email = '" . $db->escapeString($frm['email']) . "',
    468             user_type = '" . $db->escapeString($frm['user_type']) . "',
    469453            modified_by_user_id = '" . $db->escapeString($auth->get('user_id')) . "',
    470454            modified_datetime = NOW()
Note: See TracChangeset for help on using the changeset viewer.