3 # shell script to grant privileges to the bacula database
5 db_user=${db_user:-@db_user@}
7 db_name=${db_name:-@db_name@}
9 if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
11 create user ${db_user};
14 grant all on unsavedfiles to ${db_user};
15 grant all on basefiles to ${db_user};
16 grant all on jobmedia to ${db_user};
17 grant all on file to ${db_user};
18 grant all on job to ${db_user};
19 grant all on media to ${db_user};
20 grant all on client to ${db_user};
21 grant all on pool to ${db_user};
22 grant all on fileset to ${db_user};
23 grant all on path to ${db_user};
24 grant all on filename to ${db_user};
25 grant all on counters to ${db_user};
26 grant all on version to ${db_user};
27 grant all on cdimages to ${db_user};
28 grant all on mediatype to ${db_user};
29 grant all on storage to ${db_user};
30 grant all on device to ${db_user};
31 grant all on status to ${db_user};
32 grant all on location to ${db_user};
33 grant all on locationlog to ${db_user};
34 grant all on log to ${db_user};
35 grant all on jobhisto to ${db_user};
37 -- for sequences on those tables
39 grant select, update on filename_filenameid_seq to ${db_user};
40 grant select, update on path_pathid_seq to ${db_user};
41 grant select, update on fileset_filesetid_seq to ${db_user};
42 grant select, update on pool_poolid_seq to ${db_user};
43 grant select, update on client_clientid_seq to ${db_user};
44 grant select, update on media_mediaid_seq to ${db_user};
45 grant select, update on job_jobid_seq to ${db_user};
46 grant select, update on file_fileid_seq to ${db_user};
47 grant select, update on jobmedia_jobmediaid_seq to ${db_user};
48 grant select, update on basefiles_baseid_seq to ${db_user};
49 grant select, update on storage_storageid_seq to ${db_user};
50 grant select, update on mediatype_mediatypeid_seq to ${db_user};
51 grant select, update on device_deviceid_seq to ${db_user};
52 grant select, update on location_locationid_seq to ${db_user};
53 grant select, update on locationlog_loclogid_seq to ${db_user};
54 grant select, update on log_logid_seq to ${db_user};
58 echo "Privileges for ${db_user} granted on ${db_name}."
61 echo "Error creating privileges."