19
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#ifndef DRIZZLED_PLUGIN_AUTHORIZATION_H
23
#define DRIZZLED_PLUGIN_AUTHORIZATION_H
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>
31
#include <drizzled/visibility.h>
38
class Authorization : public Plugin
39
class DRIZZLED_API Authorization : public Plugin
41
42
Authorization(const Authorization &);
55
56
* @returns true if the user cannot access the schema
57
58
virtual bool restrictSchema(const drizzled::identifier::User &user_ctx,
58
SchemaIdentifier::const_reference schema)= 0;
59
const identifier::Schema& schema)= 0;
61
62
* Should we restrict the current user's access to this table?
67
68
* @returns true if the user cannot access the table
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);
73
74
* Should we restrict the current user's access to see this process?
82
83
const drizzled::identifier::User &session_ctx);
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);
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);
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);
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
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);
107
108
* Standard plugin system registration hooks
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)
117
118
return restrictSchema(user_ctx, table);