]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/grant_postgresql_privileges.in
- Apply patch supplied by Eric Bollinger to fix PostgreSQL
[bacula/bacula] / bacula / src / cats / grant_postgresql_privileges.in
1 #!/bin/sh
2 #
3 # shell script to grant privileges to the bacula database
4 #
5 USER=bacula
6 bindir=@SQL_BINDIR@
7
8 if $bindir/psql -f - -d bacula $* <<END-OF-DATA
9
10 create user ${USER};
11
12 -- for tables
13 grant all on unsavedfiles to ${USER};
14 grant all on basefiles    to ${USER};
15 grant all on jobmedia     to ${USER};
16 grant all on file         to ${USER};
17 grant all on job          to ${USER};
18 grant all on media        to ${USER};
19 grant all on client       to ${USER};
20 grant all on pool         to ${USER};
21 grant all on fileset      to ${USER};
22 grant all on path         to ${USER};
23 grant all on filename     to ${USER};
24 grant all on counters     to ${USER};
25 grant all on version      to ${USER};
26 grant all on cdimages     to ${USER};
27 grant all on mediatype    to ${USER};
28 grant all on storage      to ${USER};
29 grant all on device       to ${USER};
30 grant all on status       to ${USER};
31
32 -- for sequences on those tables
33
34 grant select, update on filename_filenameid_seq    to ${USER};
35 grant select, update on path_pathid_seq            to ${USER};
36 grant select, update on fileset_filesetid_seq      to ${USER};
37 grant select, update on pool_poolid_seq            to ${USER};
38 grant select, update on client_clientid_seq        to ${USER};
39 grant select, update on media_mediaid_seq          to ${USER};
40 grant select, update on job_jobid_seq              to ${USER};
41 grant select, update on file_fileid_seq            to ${USER};
42 grant select, update on jobmedia_jobmediaid_seq    to ${USER};
43 grant select, update on basefiles_baseid_seq       to ${USER};
44 grant select, update on storage_storageid_seq      to ${USER};
45 grant select, update on mediatype_mediatypeid_seq  to ${USER};
46 grant select, update on device_deviceid_seq        to ${USER};
47
48
49 END-OF-DATA
50 then
51    echo "Privileges for ${USER} granted."
52    exit 0
53 else
54    echo "Error creating privileges."
55    exit 1
56 fi