drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
plugin/simple_user_policy/module.cc
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2010 Monty Taylor <[email protected]>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <config.h>
21
22#include <drizzled/plugin/authorization.h>
24#include <boost/program_options.hpp>
25
26namespace po= boost::program_options;
27
28#include "policy.h"
29
30using namespace drizzled;
31
32namespace simple_user_policy
33{
34
35std::string remap_dot_to;
36
37static int init(module::Context &context)
38{
39 context.add(new Policy);
40 return 0;
41}
42
43static void init_options(drizzled::module::option_context &context)
44{
45 context("remap-dot-to",
46 po::value<std::string>(&remap_dot_to)->default_value("."),
47 N_("Remap '.' to another character/string when controlling access to a schema. Useful for usernames that have a '.' in them. If a '.' is remapped to an underscore, you don't have to quote the schema name."));
48}
49
50} /* namespace simple_user_policy */
51
52DRIZZLE_DECLARE_PLUGIN
53{
54 DRIZZLE_VERSION_ID,
55 "simple_user_policy",
56 "1.1",
57 "Monty Taylor, Stewart Smith",
58 N_("Authorization matching username to schema object name"),
59 PLUGIN_LICENSE_GPL,
60 simple_user_policy::init,
61 NULL,
62 simple_user_policy::init_options
63}
64DRIZZLE_DECLARE_PLUGIN_END;
TODO: Rename this file - func.h is stupid.
An Proxy Wrapper around boost::program_options::variables_map.