#
# Ported from DAViCal's dba/appuser_permissions.txt.
#
# Used by `davical-admin db init` / `db upgrade` to set the privileges granted
# to the lower-privilege application (runtime) database user. The schema objects
# are owned by the DBA/owner role; the application role gets only these grants.
#
# Format: a "GRANT <privileges>" line opens a block; each following "ON <object>"
# line names an object the privileges apply to. Blank lines and '#' comments are
# ignored, and all whitespace is insignificant. Objects that do not exist in the
# current schema are skipped (with a notice) rather than failing.
#

GRANT SELECT,INSERT,UPDATE,DELETE
  ON collection
  ON caldav_data
  ON calendar_item
  ON relationship
  ON locks
  ON property
  ON freebusy_ticket
  ON usr
  ON usr_setting
  ON roles
  ON role_member
  ON session
  ON tmp_password
  ON group_member
  ON principal
  ON principal_external_id
  ON relationship_type
  ON sync_tokens
  ON sync_changes
  ON grants
  ON dav_principal
  ON access_ticket
  ON dav_binding
  ON calendar_alarm
  ON calendar_attendee
  ON addressbook_resource
  ON addressbook_address_adr
  ON addressbook_address_tel
  ON addressbook_address_email
  ON timezones
  ON tz_aliases
  ON tz_localnames

GRANT SELECT,UPDATE
  ON relationship_type_rt_id_seq
  ON dav_id_seq
  ON usr_user_no_seq
  ON roles_role_no_seq
  ON session_session_id_seq
  ON principal_type_principal_type_id_seq
  ON sync_tokens_sync_token_seq
  ON timezones_our_tzno_seq
  ON metrics_count_acl
  ON metrics_count_bind
  ON metrics_count_delete
  ON metrics_count_delticket
  ON metrics_count_get
  ON metrics_count_head
  ON metrics_count_lock
  ON metrics_count_mkcalendar
  ON metrics_count_mkcol
  ON metrics_count_mkticket
  ON metrics_count_move
  ON metrics_count_options
  ON metrics_count_post
  ON metrics_count_propfind
  ON metrics_count_proppatch
  ON metrics_count_put
  ON metrics_count_report
  ON metrics_count_unknown
  ON metrics_count_unlock

GRANT SELECT
  ON supported_locales
  ON awl_db_revision
  ON principal_type
