22
22
#ifndef DRIZZLED_PLUGIN_AUTHORIZATION_H
23
23
#define DRIZZLED_PLUGIN_AUTHORIZATION_H
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"
32
#include <drizzled/visibility.h>
40
class DRIZZLED_API Authorization : public Plugin
39
class Authorization : public Plugin
43
42
Authorization(const Authorization &);
57
56
* @returns true if the user cannot access the schema
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;
63
62
* Should we restrict the current user's access to this table?
69
68
* @returns true if the user cannot access the table
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);
75
74
* Should we restrict the current user's access to see this process?
81
80
* @returns true if the user cannot see the process
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);
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);
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);
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);
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
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);
109
108
* Standard plugin system registration hooks
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)
119
118
return restrictSchema(user_ctx, table);
122
inline bool Authorization::restrictProcess(const drizzled::identifier::User &,
123
const drizzled::identifier::User &)
121
inline bool Authorization::restrictProcess(const SecurityContext &,
122
const SecurityContext &)