132
134
} /* 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));
136
bool plugin::Authorization::isAuthorized(const SecurityContext &user_ctx,
137
SchemaIdentifier &schema_identifier,
140
/* If we never loaded any authorization plugins, just return true */
141
if (authorization_plugins.empty())
144
/* Use find_if instead of foreach so that we can collect return codes */
145
vector<plugin::Authorization *>::const_iterator iter=
146
find_if(authorization_plugins.begin(),
147
authorization_plugins.end(),
148
RestrictDbFunctor(user_ctx, schema_identifier));
152
* If iter is == end() here, that means that all of the plugins returned
153
* false, which means that that each of them believe the user is authorized
154
* to view the resource in question.
156
if (iter != authorization_plugins.end())
160
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
161
user_ctx.getUser().c_str(),
162
user_ctx.getIp().c_str(),
163
schema_identifier.getSQLPath().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
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())
193
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
194
user_ctx.getUser().c_str(),
195
user_ctx.getIp().c_str(),
196
table.getSQLPath().c_str());
203
bool plugin::Authorization::isAuthorized(const SecurityContext &user_ctx,
204
const Session *session,
207
const SecurityContext &session_ctx= session->getSecurityContext();
209
/* If we never loaded any authorization plugins, just return true */
210
if (authorization_plugins.empty())
213
/* Use find_if instead of foreach so that we can collect return codes */
214
vector<plugin::Authorization *>::const_iterator iter=
215
find_if(authorization_plugins.begin(),
216
authorization_plugins.end(),
217
RestrictProcessFunctor(user_ctx, session_ctx));
231
220
* If iter is == end() here, that means that all of the plugins returned