~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/simple_user_policy/policy.h

  • Committer: Olaf van der Spek
  • Date: 2011-03-28 14:32:36 UTC
  • mto: (2257.1.1 build) (2276.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: olafvdspek@gmail.com-20110328143236-4ge1d793iqaktfq0
Common fwd

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 */