~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/security_context.h

MergedĀ build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_SECURITY_CONTEXT_H
22
22
#define DRIZZLED_SECURITY_CONTEXT_H
23
23
 
 
24
namespace drizzled
 
25
{
24
26
 
25
27
/**
26
 
  @class Security_context
 
28
  @class SecurityContext
27
29
  @brief A set of Session members describing the current authenticated user.
28
30
*/
29
31
 
30
 
class Security_context {
 
32
class SecurityContext {
31
33
public:
32
 
  Security_context() {}
33
 
  /*
34
 
    host - host of the client
35
 
    user - user of the client, set to NULL until the user has been read from
36
 
    the connection
37
 
    priv_user - The user privilege we are using. May be "" for anonymous user.
38
 
    ip - client IP
39
 
  */
 
34
  SecurityContext() {}
 
35
 
 
36
  const std::string& getIp() const
 
37
  {
 
38
    return ip;
 
39
  }
 
40
 
 
41
  void setIp(const char *newip)
 
42
  {
 
43
    ip.assign(newip);
 
44
  }
 
45
 
 
46
  const std::string& getUser() const
 
47
  {
 
48
    return user;
 
49
  }
 
50
 
 
51
  void setUser(const char *newuser)
 
52
  {
 
53
    user.assign(newuser);
 
54
  }
 
55
 
 
56
private:
40
57
  std::string user;
41
58
  std::string ip;
42
 
 
43
 
  void skip_grants();
44
 
  inline const char *priv_host_name()
45
 
  {
46
 
    return (ip.c_str() ? ip.c_str() : (char *)"%");
47
 
  }
48
59
};
49
60
 
 
61
} /* namespace drizzled */
 
62
 
50
63
#endif /* DRIZZLED_SECURITY_CONTEXT_H */