~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/simple_user_policy/policy.h

  • Committer: Lee Bieber
  • Date: 2011-03-29 22:31:41 UTC
  • mfrom: (2257.1.3 build)
  • Revision ID: kalebral@gmail.com-20110329223141-yxc22h3l2he58sk0
Merge Andrew - 743842: Build failure using GCC 4.6
Merge Stewart - 738022: CachedDirectory silently fails to add entries if stat() fails
Merge Olaf - Common fwd: add copyright, add more declaration

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
 
21
 
#ifndef PLUGIN_SIMPLE_USER_POLICY_POLICY_H
22
 
#define PLUGIN_SIMPLE_USER_POLICY_POLICY_H
 
21
#pragma once
23
22
 
24
23
#include <iostream>
25
24
 
37
36
  { }
38
37
 
39
38
  virtual bool restrictSchema(const drizzled::identifier::User &user_ctx,
40
 
                              drizzled::SchemaIdentifier::const_reference schema);
 
39
                              const drizzled::identifier::Schema& schema);
41
40
 
42
41
  virtual bool restrictProcess(const drizzled::identifier::User &user_ctx,
43
42
                               const drizzled::identifier::User &session_ctx);
44
43
};
45
44
 
46
45
inline bool Policy::restrictSchema(const drizzled::identifier::User &user_ctx,
47
 
                                   drizzled::SchemaIdentifier::const_reference schema)
 
46
                                   const drizzled::identifier::Schema& schema)
48
47
{
49
48
  if ((user_ctx.username() == "root")
50
49
      || schema.compare("data_dictionary")
51
50
      || schema.compare("information_schema"))
 
51
  {
52
52
    return false;
 
53
  }
 
54
 
53
55
  return not schema.compare(user_ctx.username());
54
56
}
55
57
 
64
66
 
65
67
} /* namespace simple_user_policy */
66
68
 
67
 
#endif /* PLUGIN_SIMPLE_USER_POLICY_POLICY_H */