~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/authorization.h

  • Committer: Patrick Crews
  • Date: 2010-12-07 20:02:50 UTC
  • Revision ID: gleebix@gmail.com-20101207200250-6a27jgqalgw5bsb5
Added disabled.def file to disable drizzleslap due to Bug#684269.  Need to skip for tarball release this round

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include "drizzled/plugin.h"
26
26
#include "drizzled/plugin/plugin.h"
 
27
#include "drizzled/security_context.h"
27
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 &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(const drizzled::identifier::User &user_ctx,
72
 
                             identifier::Table &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_shared_ptr user_ctx,
88
 
                           identifier::Schema::const_reference schema_identifier,
 
86
  static bool isAuthorized(const SecurityContext &user_ctx,
 
87
                           SchemaIdentifier &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_shared_ptr user_ctx,
93
 
                           identifier::Table &table_identifier,
94
 
                           bool send_error= true);
95
 
 
96
 
  /** Server API method for checking process authorization */
97
 
  static bool isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
98
 
                           const Session *session,
99
 
                           bool send_error= true);
100
 
 
101
 
  /** Server API method for checking process authorization */
102
 
  static bool isAuthorized(drizzled::identifier::User::const_reference user_ctx,
 
91
  static bool isAuthorized(const SecurityContext &user_ctx,
 
92
                           TableIdentifier &table_identifier,
 
93
                           bool send_error= true);
 
94
 
 
95
  /** Server API method for checking process authorization */
 
96
  static bool isAuthorized(const SecurityContext &user_ctx,
103
97
                           const Session *session,
104
98
                           bool send_error= true);
105
99
 
107
101
   * Server API helper method for applying authorization tests
108
102
   * to a set of schema names (for use in the context of getSchemaNames
109
103
   */
110
 
  static void pruneSchemaNames(drizzled::identifier::User::const_shared_ptr user_ctx,
111
 
                               identifier::Schema::vector &set_of_schemas);
 
104
  static void pruneSchemaNames(const SecurityContext &user_ctx,
 
105
                               SchemaIdentifier::vector &set_of_schemas);
112
106
  
113
107
  /**
114
108
   * Standard plugin system registration hooks
118
112
 
119
113
};
120
114
 
121
 
inline bool Authorization::restrictTable(const drizzled::identifier::User &user_ctx,
122
 
                                         identifier::Table &table)
 
115
inline bool Authorization::restrictTable(const SecurityContext &user_ctx,
 
116
                                         TableIdentifier &table)
123
117
{
124
118
  return restrictSchema(user_ctx, table);
125
119
}
126
120
 
127
 
inline bool Authorization::restrictProcess(const drizzled::identifier::User &,
128
 
                                           const drizzled::identifier::User &)
 
121
inline bool Authorization::restrictProcess(const SecurityContext &,
 
122
                                           const SecurityContext &)
129
123
{
130
124
  return false;
131
125
}