~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/user.h

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2010 Brian Aker
5
 
 *  Copyright (C) 2008 Sun Microsystems
6
 
 *
7
 
 *  This program is free software; you can redistribute it and/or modify
8
 
 *  it under the terms of the GNU General Public License as published by
9
 
 *  the Free Software Foundation; version 2 of the License.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with this program; if not, write to the Free Software
18
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 */
20
 
 
21
 
 
22
 
#ifndef DRIZZLED_IDENTIFIER_USER_H
23
 
#define DRIZZLED_IDENTIFIER_USER_H
24
 
 
25
 
#include <string>
26
 
#include <boost/shared_ptr.hpp>
27
 
 
28
 
#include "drizzled/visibility.h"
29
 
 
30
 
namespace drizzled
31
 
{
32
 
namespace identifier
33
 
{
34
 
 
35
 
/**
36
 
  @class User
37
 
  @brief A set of Session members describing the current authenticated user.
38
 
*/
39
 
 
40
 
class User : public Identifier
41
 
{
42
 
public:
43
 
  typedef boost::shared_ptr<User> shared_ptr;
44
 
  typedef boost::shared_ptr<const User> const_shared_ptr;
45
 
  typedef const User& const_reference;
46
 
  DRIZZLED_API static shared_ptr make_shared();
47
 
 
48
 
  enum PasswordType
49
 
  {
50
 
    PLAIN_TEXT,
51
 
    MYSQL_HASH
52
 
  };
53
 
 
54
 
  User():
55
 
    password_type(PLAIN_TEXT),
56
 
    _user(""),
57
 
    _address("")
58
 
  { }
59
 
 
60
 
  virtual void getSQLPath(std::string &arg) const;
61
 
 
62
 
  const std::string& address() const
63
 
  {
64
 
    return _address;
65
 
  }
66
 
 
67
 
  void setAddress(const char *newip)
68
 
  {
69
 
    _address.assign(newip);
70
 
  }
71
 
 
72
 
  const std::string& username() const
73
 
  {
74
 
    return _user;
75
 
  }
76
 
 
77
 
  void setUser(const std::string &newuser)
78
 
  {
79
 
    _user.assign(newuser);
80
 
  }
81
 
 
82
 
  PasswordType getPasswordType(void) const
83
 
  {
84
 
    return password_type;
85
 
  }
86
 
 
87
 
  void setPasswordType(PasswordType newpassword_type)
88
 
  {
89
 
    password_type= newpassword_type;
90
 
  }
91
 
 
92
 
  const std::string& getPasswordContext() const
93
 
  {
94
 
    return password_context;
95
 
  }
96
 
 
97
 
  void setPasswordContext(const char *newpassword_context, size_t size)
98
 
  {
99
 
    password_context.assign(newpassword_context, size);
100
 
  }
101
 
 
102
 
private:
103
 
  PasswordType password_type;
104
 
  std::string _user;
105
 
  std::string _address;
106
 
  std::string password_context;
107
 
};
108
 
 
109
 
} /* namespace identifier */
110
 
} /* namespace drizzled */
111
 
 
112
 
#endif /* DRIZZLED_IDENTIFIER_USER_H */