~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/authorization.h

  • Committer: Brian Aker
  • Date: 2010-12-17 00:08:06 UTC
  • mfrom: (2002.1.4 clean)
  • Revision ID: brian@tangent.org-20101217000806-fa6kmggjnhsl4q85
Rollup for field encapsulation, monty fix for bzrignore, and Andrew bug
fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#ifndef DRIZZLED_PLUGIN_AUTHORIZATION_H
23
23
#define DRIZZLED_PLUGIN_AUTHORIZATION_H
24
24
 
25
 
#include <drizzled/plugin.h>
26
 
#include <drizzled/plugin/plugin.h>
27
 
#include <drizzled/identifier.h>
 
25
#include "drizzled/plugin.h"
 
26
#include "drizzled/plugin/plugin.h"
 
27
#include "drizzled/security_context.h"
 
28
#include "drizzled/identifier.h"
28
29
 
29
30
#include <string>
30
31
#include <set>
31
32
 
32
 
#include <drizzled/visibility.h>
33
 
 
34
33
namespace drizzled
35
34
{
36
35
 
37
36
namespace plugin
38
37
{
39
38
 
40
 
class DRIZZLED_API Authorization : public Plugin
 
39
class Authorization : public Plugin
41
40
{
42
41
  Authorization();
43
42
  Authorization(const Authorization &);
56
55
   *
57
56
   * @returns true if the user cannot access the schema
58
57
   */
59
 
  virtual bool restrictSchema(const drizzled::identifier::User &user_ctx,
60
 
                              identifier::Schema::const_reference schema)= 0;
 
58
  virtual bool restrictSchema(const SecurityContext &user_ctx,
 
59
                              SchemaIdentifier::const_reference schema)= 0;
61
60
 
62
61
  /**
63
62
   * Should we restrict the current user's access to this table?
68
67
   *
69
68
   * @returns true if the user cannot access the table
70
69
   */
71
 
  virtual bool restrictTable(drizzled::identifier::User::const_reference user_ctx,
72
 
                             drizzled::identifier::Table::const_reference table);
 
70
  virtual bool restrictTable(const SecurityContext &user_ctx,
 
71
                             TableIdentifier &table);
73
72
 
74
73
  /**
75
74
   * Should we restrict the current user's access to see this process?
80
79
   *
81
80
   * @returns true if the user cannot see the process
82
81
   */
83
 
  virtual bool restrictProcess(const drizzled::identifier::User &user_ctx,
84
 
                               const drizzled::identifier::User &session_ctx);
 
82
  virtual bool restrictProcess(const SecurityContext &user_ctx,
 
83
                               const SecurityContext &session_ctx);
85
84
 
86
85
  /** Server API method for checking schema authorization */
87
 
  static bool isAuthorized(drizzled::identifier::User::const_reference user_ctx,
88
 
                           identifier::Schema::const_reference schema_identifier,
 
86
  static bool isAuthorized(const SecurityContext &user_ctx,
 
87
                           SchemaIdentifier::const_reference schema_identifier,
89
88
                           bool send_error= true);
90
89
 
91
90
  /** Server API method for checking table authorization */
92
 
  static bool isAuthorized(drizzled::identifier::User::const_reference user_ctx,
93
 
                           drizzled::identifier::Table::const_reference table_identifier,
 
91
  static bool isAuthorized(const SecurityContext &user_ctx,
 
92
                           TableIdentifier &table_identifier,
94
93
                           bool send_error= true);
95
94
 
96
95
  /** Server API method for checking process authorization */
97
 
  static bool isAuthorized(drizzled::identifier::User::const_reference user_ctx,
98
 
                           const Session &session,
 
96
  static bool isAuthorized(const SecurityContext &user_ctx,
 
97
                           const Session *session,
99
98
                           bool send_error= true);
100
99
 
101
100
  /**
102
101
   * Server API helper method for applying authorization tests
103
102
   * to a set of schema names (for use in the context of getSchemaNames
104
103
   */
105
 
  static void pruneSchemaNames(drizzled::identifier::User::const_reference user_ctx,
106
 
                               identifier::Schema::vector &set_of_schemas);
 
104
  static void pruneSchemaNames(const SecurityContext &user_ctx,
 
105
                               SchemaIdentifier::vector &set_of_schemas);
107
106
  
108
107
  /**
109
108
   * Standard plugin system registration hooks
113
112
 
114
113
};
115
114
 
116
 
inline bool Authorization::restrictTable(drizzled::identifier::User::const_reference user_ctx,
117
 
                                         drizzled::identifier::Table::const_reference table)
 
115
inline bool Authorization::restrictTable(const SecurityContext &user_ctx,
 
116
                                         TableIdentifier &table)
118
117
{
119
118
  return restrictSchema(user_ctx, table);
120
119
}
121
120
 
122
 
inline bool Authorization::restrictProcess(const drizzled::identifier::User &,
123
 
                                           const drizzled::identifier::User &)
 
121
inline bool Authorization::restrictProcess(const SecurityContext &,
 
122
                                           const SecurityContext &)
124
123
{
125
124
  return false;
126
125
}