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"
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 &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(const drizzled::identifier::User &user_ctx,
72
identifier::Table &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_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);
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);
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);
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);
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);
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
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);
114
108
* Standard plugin system registration hooks
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)
124
118
return restrictSchema(user_ctx, table);
127
inline bool Authorization::restrictProcess(const drizzled::identifier::User &,
128
const drizzled::identifier::User &)
121
inline bool Authorization::restrictProcess(const SecurityContext &,
122
const SecurityContext &)