132
133
} /* namespace */
134
bool plugin::Authorization::isAuthorized(identifier::User::const_shared_ptr user_ctx,
135
identifier::Schema::const_reference schema_identifier,
138
/* If we never loaded any authorization plugins, just return true */
139
if (authorization_plugins.empty())
142
/* Use find_if instead of foreach so that we can collect return codes */
143
std::vector<plugin::Authorization *>::const_iterator iter=
144
std::find_if(authorization_plugins.begin(),
145
authorization_plugins.end(),
146
RestrictDbFunctor(*user_ctx, schema_identifier));
150
* If iter is == end() here, that means that all of the plugins returned
151
* false, which means that that each of them believe the user is authorized
152
* to view the resource in question.
154
if (iter != authorization_plugins.end())
159
schema_identifier.getSQLPath(path);
161
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
162
user_ctx->username().c_str(),
163
user_ctx->address().c_str(),
171
bool plugin::Authorization::isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
172
identifier::Table &table,
175
/* If we never loaded any authorization plugins, just return true */
176
if (authorization_plugins.empty())
179
/* Use find_if instead of foreach so that we can collect return codes */
180
std::vector<plugin::Authorization *>::const_iterator iter=
181
std::find_if(authorization_plugins.begin(),
182
authorization_plugins.end(),
183
RestrictTableFunctor(*user_ctx, table));
186
* If iter is == end() here, that means that all of the plugins returned
187
* false, which means that that each of them believe the user is authorized
188
* to view the resource in question.
190
if (iter != authorization_plugins.end())
195
table.getSQLPath(path);
197
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
198
user_ctx->username().c_str(),
199
user_ctx->address().c_str(),
207
bool plugin::Authorization::isAuthorized(drizzled::identifier::User::const_shared_ptr user_ctx,
208
const Session *session,
211
return isAuthorized(*user_ctx, session, send_error);
214
bool plugin::Authorization::isAuthorized(drizzled::identifier::User::const_reference user_ctx,
215
const Session *session,
218
drizzled::identifier::User::const_shared_ptr session_ctx= session->user();
220
/* If we never loaded any authorization plugins, just return true */
221
if (authorization_plugins.empty())
224
/* Use find_if instead of foreach so that we can collect return codes */
225
std::vector<plugin::Authorization *>::const_iterator iter=
226
std::find_if(authorization_plugins.begin(),
227
authorization_plugins.end(),
228
RestrictProcessFunctor(user_ctx, *session_ctx));
135
bool plugin::Authorization::isAuthorized(const SecurityContext &user_ctx,
136
SchemaIdentifier &schema_identifier,
139
/* If we never loaded any authorization plugins, just return true */
140
if (authorization_plugins.empty())
143
/* Use find_if instead of foreach so that we can collect return codes */
144
vector<plugin::Authorization *>::const_iterator iter=
145
find_if(authorization_plugins.begin(),
146
authorization_plugins.end(),
147
RestrictDbFunctor(user_ctx, schema_identifier));
151
* If iter is == end() here, that means that all of the plugins returned
152
* false, which means that that each of them believe the user is authorized
153
* to view the resource in question.
155
if (iter != authorization_plugins.end())
159
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
160
user_ctx.getUser().c_str(),
161
user_ctx.getIp().c_str(),
162
schema_identifier.getSQLPath().c_str());
169
bool plugin::Authorization::isAuthorized(const SecurityContext &user_ctx,
170
TableIdentifier &table,
173
/* If we never loaded any authorization plugins, just return true */
174
if (authorization_plugins.empty())
177
/* Use find_if instead of foreach so that we can collect return codes */
178
vector<plugin::Authorization *>::const_iterator iter=
179
find_if(authorization_plugins.begin(),
180
authorization_plugins.end(),
181
RestrictTableFunctor(user_ctx, table));
184
* If iter is == end() here, that means that all of the plugins returned
185
* false, which means that that each of them believe the user is authorized
186
* to view the resource in question.
188
if (iter != authorization_plugins.end())
192
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
193
user_ctx.getUser().c_str(),
194
user_ctx.getIp().c_str(),
195
table.getSQLPath().c_str());
202
bool plugin::Authorization::isAuthorized(const SecurityContext &user_ctx,
203
const Session *session,
206
const SecurityContext &session_ctx= session->getSecurityContext();
208
/* If we never loaded any authorization plugins, just return true */
209
if (authorization_plugins.empty())
212
/* Use find_if instead of foreach so that we can collect return codes */
213
vector<plugin::Authorization *>::const_iterator iter=
214
find_if(authorization_plugins.begin(),
215
authorization_plugins.end(),
216
RestrictProcessFunctor(user_ctx, session_ctx));
231
219
* If iter is == end() here, that means that all of the plugins returned