158
error::access(user_ctx, schema_identifier);
165
bool plugin::Authorization::isAuthorized(drizzled::identifier::User::const_reference user_ctx,
166
identifier::Table::const_reference table_identifier,
169
/* If we never loaded any authorization plugins, just return true */
170
if (authorization_plugins.empty())
173
/* Use find_if instead of foreach so that we can collect return codes */
174
std::vector<plugin::Authorization *>::const_iterator iter=
175
std::find_if(authorization_plugins.begin(),
176
authorization_plugins.end(),
177
RestrictTableFunctor(user_ctx, table_identifier));
180
* If iter is == end() here, that means that all of the plugins returned
181
* false, which means that that each of them believe the user is authorized
182
* to view the resource in question.
184
if (iter != authorization_plugins.end())
188
error::access(user_ctx, table_identifier);
195
bool plugin::Authorization::isAuthorized(drizzled::identifier::User::const_reference user_ctx,
196
Session::const_reference session,
199
/* If we never loaded any authorization plugins, just return true */
200
if (authorization_plugins.empty())
203
// To make sure we hold the user structure we need to have a shred_ptr so
204
// that we increase the count on the object.
205
drizzled::identifier::User::const_shared_ptr session_ctx= session.user();
208
/* Use find_if instead of foreach so that we can collect return codes */
209
std::vector<plugin::Authorization *>::const_iterator iter=
210
std::find_if(authorization_plugins.begin(),
211
authorization_plugins.end(),
212
RestrictProcessFunctor(user_ctx, *session_ctx));
215
* If iter is == end() here, that means that all of the plugins returned
216
* false, which means that that each of them believe the user is authorized
217
* to view the resource in question.
220
if (iter != authorization_plugins.end())
224
my_error(ER_KILL_DENIED_ERROR, MYF(0), session.thread_id);
232
void plugin::Authorization::pruneSchemaNames(drizzled::identifier::User::const_reference user_ctx,
233
identifier::Schema::vector &set_of_schemas)
158
schema_identifier.getSQLPath(path);
160
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
161
user_ctx.getUser().c_str(),
162
user_ctx.getIp().c_str(),
170
bool plugin::Authorization::isAuthorized(const SecurityContext &user_ctx,
171
TableIdentifier &table,
174
/* If we never loaded any authorization plugins, just return true */
175
if (authorization_plugins.empty())
178
/* Use find_if instead of foreach so that we can collect return codes */
179
std::vector<plugin::Authorization *>::const_iterator iter=
180
find_if(authorization_plugins.begin(),
181
authorization_plugins.end(),
182
RestrictTableFunctor(user_ctx, table));
185
* If iter is == end() here, that means that all of the plugins returned
186
* false, which means that that each of them believe the user is authorized
187
* to view the resource in question.
189
if (iter != authorization_plugins.end())
194
table.getSQLPath(path);
196
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
197
user_ctx.getUser().c_str(),
198
user_ctx.getIp().c_str(),
206
bool plugin::Authorization::isAuthorized(const SecurityContext &user_ctx,
207
const Session *session,
210
const SecurityContext &session_ctx= session->getSecurityContext();
212
/* If we never loaded any authorization plugins, just return true */
213
if (authorization_plugins.empty())
216
/* Use find_if instead of foreach so that we can collect return codes */
217
std::vector<plugin::Authorization *>::const_iterator iter=
218
find_if(authorization_plugins.begin(),
219
authorization_plugins.end(),
220
RestrictProcessFunctor(user_ctx, session_ctx));
223
* If iter is == end() here, that means that all of the plugins returned
224
* false, which means that that each of them believe the user is authorized
225
* to view the resource in question.
228
if (iter != authorization_plugins.end())
232
my_error(ER_KILL_DENIED_ERROR, MYF(0), session->thread_id);
239
void plugin::Authorization::pruneSchemaNames(const SecurityContext &user_ctx,
240
SchemaIdentifier::vector &set_of_schemas)
235
242
/* If we never loaded any authorization plugins, just return true */
236
243
if (authorization_plugins.empty())
239
set_of_schemas.erase(std::remove_if(set_of_schemas.begin(),
240
set_of_schemas.end(),
241
PruneSchemaFunctor(user_ctx)),
246
set_of_schemas.erase(remove_if(set_of_schemas.begin(),
247
set_of_schemas.end(),
248
PruneSchemaFunctor(user_ctx)),
242
249
set_of_schemas.end());