~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/authorization.h

  • Committer: Brian Aker
  • Date: 2010-12-18 10:14:05 UTC
  • mfrom: (2008.1.3 clean)
  • Revision ID: brian@tangent.org-20101218101405-qjbse29shi9coklg
Merge of user identifier work

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