add customer fields option with agent, display_custnum, status and name, RT#73721
[freeside.git] / bin / pg-readonly
index 4f6d7c3..b5cde4d 100644 (file)
@@ -17,6 +17,39 @@ my $dbh = adminsuidsetup $user;
 foreach my $table ( dbdef->tables ) {
   $dbh->do("GRANT SELECT ON $table TO $rouser");
   $dbh->commit();
-  $dbh->do("GRANT SELECT ON ${table}_seq TO $rouser");
+  if ( my $pkey = dbdef->table($table)->primary_key ) {
+    $dbh->do("GRANT SELECT ON ${table}_${pkey}_seq TO $rouser");
+    $dbh->commit();
+  }
+}
+
+my @rt_tables = qw(
+Attachments
+Queues
+Links
+Principals
+Groups
+ScripConditions
+Transactions
+Scrips
+ACL
+GroupMembers
+CachedGroupMembers
+Users
+Tickets
+ScripActions
+Templates
+ObjectCustomFieldValues
+CustomFields
+ObjectCustomFields
+CustomFieldValues
+Attributes
+sessions
+);
+
+foreach my $table ( @rt_tables ) {
+  $dbh->do("GRANT SELECT ON $table TO $rouser");
+  $dbh->commit();
+  $dbh->do("GRANT SELECT ON ${table}_id_seq TO $rouser");
   $dbh->commit();
 }