~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/utility_functions/user.cc

  • Committer: Monty Taylor
  • Date: 2010-12-05 07:35:32 UTC
  • mfrom: (1974 b)
  • mto: (1975.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1976.
  • Revision ID: mordred@inaugust.com-20101205073532-hehqwv27pbd7byjm
Merged source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *  Copyright (C) 2010 Stewart Smith
6
6
 *
7
7
 *  This program is free software; you can redistribute it and/or modify
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
 
23
23
#include <drizzled/session.h>
24
 
#include <plugin/utility_functions/functions.h>
 
24
#include "plugin/utility_functions/functions.h"
25
25
 
26
26
namespace drizzled
27
27
{
33
33
String *User::val_str(String *str)
34
34
{
35
35
  assert(fixed == 1);
36
 
  identifier::User::const_shared_ptr user= getSession().user();
37
 
  assert(user);
38
 
  if (user->username().empty())
 
36
  Session *session= current_session;
 
37
  if (session->getSecurityContext().getUser().empty())
39
38
  {
40
39
    null_value= 1;
41
40
    return 0;
42
41
  }
43
42
  else
44
43
  {
45
 
    str->copy(user->username().c_str(), user->username().length(), system_charset_info);
 
44
    str->copy(session->getSecurityContext().getUser().c_str(), session->getSecurityContext().getUser().length(), system_charset_info);
46
45
  }
47
46
  return str;
48
47
}