~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/authorization.h

  • Committer: Olaf van der Spek
  • Date: 2011-07-07 13:41:07 UTC
  • mto: This revision was merged to the branch mainline in revision 2385.
  • Revision ID: olafvdspek@gmail.com-20110707134107-6mi7pauiatxtf4oe
Rename strmake to strdup (standard name)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
20
 */
21
21
 
22
 
#ifndef DRIZZLED_PLUGIN_AUTHORIZATION_H
23
 
#define DRIZZLED_PLUGIN_AUTHORIZATION_H
 
22
#pragma once
24
23
 
25
 
#include "drizzled/plugin.h"
26
 
#include "drizzled/plugin/plugin.h"
27
 
#include "drizzled/identifier.h"
 
24
#include <drizzled/plugin.h>
 
25
#include <drizzled/plugin/plugin.h>
 
26
#include <drizzled/identifier.h>
28
27
 
29
28
#include <string>
30
29
#include <set>
31
30
 
 
31
#include <drizzled/visibility.h>
 
32
 
32
33
namespace drizzled
33
34
{
34
35
 
35
36
namespace plugin
36
37
{
37
38
 
38
 
class Authorization : public Plugin
 
39
class DRIZZLED_API Authorization : public Plugin
39
40
{
40
41
  Authorization();
41
42
  Authorization(const Authorization &);
55
56
   * @returns true if the user cannot access the schema
56
57
   */
57
58
  virtual bool restrictSchema(const drizzled::identifier::User &user_ctx,
58
 
                              SchemaIdentifier::const_reference schema)= 0;
 
59
                              const identifier::Schema& schema)= 0;
59
60
 
60
61
  /**
61
62
   * Should we restrict the current user's access to this table?
66
67
   *
67
68
   * @returns true if the user cannot access the table
68
69
   */
69
 
  virtual bool restrictTable(const drizzled::identifier::User &user_ctx,
70
 
                             TableIdentifier &table);
 
70
  virtual bool restrictTable(const drizzled::identifier::User& user_ctx,
 
71
                             const drizzled::identifier::Table& table);
71
72
 
72
73
  /**
73
74
   * Should we restrict the current user's access to see this process?
82
83
                               const drizzled::identifier::User &session_ctx);
83
84
 
84
85
  /** Server API method for checking schema authorization */
85
 
  static bool isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
86
 
                           SchemaIdentifier::const_reference schema_identifier,
 
86
  static bool isAuthorized(const drizzled::identifier::User& user_ctx,
 
87
                           const identifier::Schema& schema_identifier,
87
88
                           bool send_error= true);
88
89
 
89
90
  /** Server API method for checking table authorization */
90
 
  static bool isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
91
 
                           TableIdentifier &table_identifier,
 
91
  static bool isAuthorized(const drizzled::identifier::User& user_ctx,
 
92
                           const drizzled::identifier::Table& table_identifier,
92
93
                           bool send_error= true);
93
94
 
94
95
  /** Server API method for checking process authorization */
95
 
  static bool isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
96
 
                           const Session *session,
 
96
  static bool isAuthorized(const drizzled::identifier::User& user_ctx,
 
97
                           const Session &session,
97
98
                           bool send_error= true);
98
99
 
99
100
  /**
100
101
   * Server API helper method for applying authorization tests
101
102
   * to a set of schema names (for use in the context of getSchemaNames
102
103
   */
103
 
  static void pruneSchemaNames(drizzled::identifier::User::const_shared_ptr user_ctx,
104
 
                               SchemaIdentifier::vector &set_of_schemas);
 
104
  static void pruneSchemaNames(const drizzled::identifier::User& user_ctx,
 
105
                               identifier::schema::vector &set_of_schemas);
105
106
  
106
107
  /**
107
108
   * Standard plugin system registration hooks
111
112
 
112
113
};
113
114
 
114
 
inline bool Authorization::restrictTable(const drizzled::identifier::User &user_ctx,
115
 
                                         TableIdentifier &table)
 
115
inline bool Authorization::restrictTable(const drizzled::identifier::User& user_ctx,
 
116
                                         const drizzled::identifier::Table& table)
116
117
{
117
118
  return restrictSchema(user_ctx, table);
118
119
}
127
128
 
128
129
} /* namespace drizzled */
129
130
 
130
 
#endif /* DRIZZLED_PLUGIN_AUTHORIZATION_H */