~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:
24
24
 
25
25
#include "drizzled/plugin.h"
26
26
#include "drizzled/plugin/plugin.h"
27
 
#include "drizzled/security_context.h"
28
27
#include "drizzled/identifier.h"
29
28
 
30
29
#include <string>
55
54
   *
56
55
   * @returns true if the user cannot access the schema
57
56
   */
58
 
  virtual bool restrictSchema(const SecurityContext &user_ctx,
 
57
  virtual bool restrictSchema(const drizzled::identifier::User &user_ctx,
59
58
                              SchemaIdentifier::const_reference schema)= 0;
60
59
 
61
60
  /**
67
66
   *
68
67
   * @returns true if the user cannot access the table
69
68
   */
70
 
  virtual bool restrictTable(const SecurityContext &user_ctx,
 
69
  virtual bool restrictTable(const drizzled::identifier::User &user_ctx,
71
70
                             TableIdentifier &table);
72
71
 
73
72
  /**
79
78
   *
80
79
   * @returns true if the user cannot see the process
81
80
   */
82
 
  virtual bool restrictProcess(const SecurityContext &user_ctx,
83
 
                               const SecurityContext &session_ctx);
 
81
  virtual bool restrictProcess(const drizzled::identifier::User &user_ctx,
 
82
                               const drizzled::identifier::User &session_ctx);
84
83
 
85
84
  /** Server API method for checking schema authorization */
86
 
  static bool isAuthorized(const SecurityContext &user_ctx,
 
85
  static bool isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
87
86
                           SchemaIdentifier::const_reference schema_identifier,
88
87
                           bool send_error= true);
89
88
 
90
89
  /** Server API method for checking table authorization */
91
 
  static bool isAuthorized(const SecurityContext &user_ctx,
 
90
  static bool isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
92
91
                           TableIdentifier &table_identifier,
93
92
                           bool send_error= true);
94
93
 
95
94
  /** Server API method for checking process authorization */
96
 
  static bool isAuthorized(const SecurityContext &user_ctx,
 
95
  static bool isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
97
96
                           const Session *session,
98
97
                           bool send_error= true);
99
98
 
101
100
   * Server API helper method for applying authorization tests
102
101
   * to a set of schema names (for use in the context of getSchemaNames
103
102
   */
104
 
  static void pruneSchemaNames(const SecurityContext &user_ctx,
 
103
  static void pruneSchemaNames(drizzled::identifier::User::const_shared_ptr user_ctx,
105
104
                               SchemaIdentifier::vector &set_of_schemas);
106
105
  
107
106
  /**
112
111
 
113
112
};
114
113
 
115
 
inline bool Authorization::restrictTable(const SecurityContext &user_ctx,
 
114
inline bool Authorization::restrictTable(const drizzled::identifier::User &user_ctx,
116
115
                                         TableIdentifier &table)
117
116
{
118
117
  return restrictSchema(user_ctx, table);
119
118
}
120
119
 
121
 
inline bool Authorization::restrictProcess(const SecurityContext &,
122
 
                                           const SecurityContext &)
 
120
inline bool Authorization::restrictProcess(const drizzled::identifier::User &,
 
121
                                           const drizzled::identifier::User &)
123
122
{
124
123
  return false;
125
124
}