Ejemplo n.º 1
0
/**
 * Get user authentication name.
 *
 * @param int $authType
 *
 * @return string
 */
function user_auth_type2str($authType)
{
    if ($authType === null) {
        $authType = getUserGuiAccess(CWebUser::$data['userid']);
    }
    $authUserType = array(GROUP_GUI_ACCESS_SYSTEM => _('System default'), GROUP_GUI_ACCESS_INTERNAL => _x('Internal', 'user type'), GROUP_GUI_ACCESS_DISABLED => _('Disabled'));
    return isset($authUserType[$authType]) ? $authUserType[$authType] : _('Unknown');
}
Ejemplo n.º 2
0
        $messageFailed = _('Cannot change authentication method to HTTP');
        DBstart();
        $result = update_config($config);
        if ($result) {
            // reset all sessions
            if ($isAuthenticationTypeChanged) {
                $result &= DBexecute('UPDATE sessions SET status=' . ZBX_SESSION_PASSIVE . ' WHERE sessionid<>' . zbx_dbstr(CWebUser::$data['sessionid']));
            }
            $isAuthenticationTypeChanged = false;
            add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ZABBIX_CONFIG, $messageSuccess);
        }
        $result = DBend($result);
        show_messages($result, $messageSuccess, $messageFailed);
    }
}
show_messages();
/*
 * Display
 */
$data = array('form_refresh' => getRequest('form_refresh'), 'config' => $config, 'is_authentication_type_changed' => $isAuthenticationTypeChanged, 'user' => getRequest('user', CWebUser::$data['alias']), 'user_password' => getRequest('user_password', ''), 'user_list' => null, 'change_bind_password' => getRequest('change_bind_password'));
// get tab title
$data['title'] = authentication2str($config['authentication_type']);
// get user list
if (getUserGuiAccess(CWebUser::$data['userid']) == GROUP_GUI_ACCESS_INTERNAL) {
    $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid FROM users u ORDER BY u.alias'));
}
// render view
$authenticationView = new CView('administration.authentication.edit', $data);
$authenticationView->render();
$authenticationView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
Ejemplo n.º 3
0
/**
 * Get user authentication type.
 *
 * @param string $userId
 * @param int    $maxGuiAccess
 *
 * @return int
 */
function getUserAuthenticationType($userId, $maxGuiAccess = null)
{
    $config = select_config();
    switch (getUserGuiAccess($userId, $maxGuiAccess)) {
        case GROUP_GUI_ACCESS_SYSTEM:
            return $config['authentication_type'];
        case GROUP_GUI_ACCESS_INTERNAL:
            return $config['authentication_type'] == ZBX_AUTH_HTTP ? ZBX_AUTH_HTTP : ZBX_AUTH_INTERNAL;
        default:
            return $config['authentication_type'];
    }
}