/ db / functions /
/db/functions/macros.m4
1 dnl Copyright (C) 2012 The Meme Factory, Inc. http://www.meme.com/
2 dnl Copyright (C) 2004, 2008, Karl O. Pinc <kop@meme.com>
3 dnl
4 dnl This file is part of Gombe-MI.
5 dnl
6 dnl Gombe-MI is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3 of the License, or
9 dnl (at your option) any later version.
10 dnl
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
18 dnl
19 dnl M4 macros for making functions to support Gombe-MI on the server side.
20 dnl Karl O. Pinc <kop@meme.com>
21 dnl
22 dnl
23 dnl m4 includes
24 include(`copyright.m4')
25 include(`globalmacros.m4')
26 dnl
27 dnl Don't ouput while defining functions.
28 divert(-1)
29
30
31 dnl Grant privliges to a function.
32 dnl
33 dnl This also prints the name of the function. As every function has
34 dnl priviliges granted on it we get to monitor progress this way.
35 dnl
36 dnl Syntax: grant_func_priv(function_declaration)
37 changequote([,])
38 define([grant_func_priv],[
39 GRANT EXECUTE ON FUNCTION $1
40 TO GROUP gombemi_editors;
41 SELECT '$1' AS done_with;
42 ])
43 changequote(`,')
44
45
46 dnl Grant everybody privliges to a function.
47 dnl
48 dnl This also prints the name of the function. As every function has
49 dnl priviliges granted on it we get to monitor progress this way.
50 dnl
51 dnl Syntax: grant_everybody_func_priv(function_declaration)
52 changequote([,])
53 define([grant_everybody_func_priv],[
54 GRANT EXECUTE ON FUNCTION $1
55 TO GROUP gombemi_editors;
56 GRANT EXECUTE ON FUNCTION $1
57 TO GROUP gombemi_readers;
58 SELECT '$1' AS done_with;
59 ])
60 changequote(`,')
61
62 dnl Turn output back on.
63 divert`'dnl