github.com/rigado/snapd@v2.42.5-go-mod+incompatible/interfaces/builtin/calendar_service.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2018 Canonical Ltd
     5   *
     6   * This program is free software: you can redistribute it and/or modify
     7   * it under the terms of the GNU General Public License version 3 as
     8   * published by the Free Software Foundation.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17   *
    18   */
    19  
    20  package builtin
    21  
    22  import (
    23  	"github.com/snapcore/snapd/release"
    24  )
    25  
    26  const calendarServiceSummary = `allows communication with Evolution Data Service Calendar`
    27  
    28  const calendarServiceBaseDeclarationSlots = `
    29    calendar-service:
    30      allow-installation:
    31        slot-snap-type:
    32          - core
    33      deny-auto-connection: true
    34  `
    35  
    36  const calendarServiceConnectedPlugAppArmor = `
    37  # Description: Allow access to Evolution Data Service for calendars
    38  
    39  #include <abstractions/dbus-session-strict>
    40  
    41  # Allow use of ObjectManager APIs, used to enumerate sources
    42  dbus (receive, send)
    43  	bus=session
    44  	interface=org.freedesktop.DBus.ObjectManager
    45  	path=/org/gnome/evolution/dataserver{,/**}
    46  	peer=(label=unconfined),
    47  
    48  # Allow access to properties on sources
    49  dbus (receive, send)
    50  	bus=session
    51  	interface=org.freedesktop.DBus.Properties
    52  	path=/org/gnome/evolution/dataserver/SourceManager{,/**}
    53  	peer=(label=unconfined),
    54  dbus (receive, send)
    55  	bus=session
    56  	interface=org.freedesktop.DBus.Properties
    57  	path=/org/gnome/evolution/dataserver/Calendar{,/**}
    58  	peer=(label=unconfined),
    59  dbus (receive, send)
    60  	bus=session
    61  	interface=org.freedesktop.DBus.Properties
    62  	path=/org/gnome/evolution/dataserver/CalendarFactory
    63  	peer=(label=unconfined),
    64  dbus (receive, send)
    65  	bus=session
    66  	interface=org.freedesktop.DBus.Properties
    67  	path=/org/gnome/evolution/dataserver/CalendarView{,/**}
    68  	peer=(label=unconfined),
    69  dbus (receive, send)
    70  	bus=session
    71  	interface=org.freedesktop.DBus.Properties
    72  	path=/org/gnome/evolution/dataserver/Subprocess{,/**}
    73  	peer=(label=unconfined),
    74  # Allow access to methods
    75  dbus (receive, send)
    76  	bus=session
    77  	interface=org.gnome.evolution.dataserver.Calendar
    78  	path=/org/gnome/evolution/dataserver/{Subprocess,Calendar}{,/**}
    79  	peer=(label=unconfined),
    80  dbus (receive, send)
    81  	bus=session
    82  	interface=org.gnome.evolution.dataserver.CalendarFactory
    83  	path=/org/gnome/evolution/dataserver/CalendarFactory
    84  	peer=(label=unconfined),
    85  dbus (receive, send)
    86  	bus=session
    87  	interface=org.gnome.evolution.dataserver.CalendarView
    88  	path=/org/gnome/evolution/dataserver/CalendarView{,/**}
    89  	peer=(label=unconfined),
    90  dbus (receive, send)
    91  	bus=session
    92  	interface=org.gnome.evolution.dataserver.Source
    93  	path=/org/gnome/evolution/dataserver/SourceManager{,/**}
    94  	peer=(label=unconfined),
    95  dbus (receive, send)
    96  	bus=session
    97  	interface=org.gnome.evolution.dataserver.Source.Removable
    98  	path=/org/gnome/evolution/dataserver/SourceManager{,/**}
    99  	peer=(label=unconfined),
   100  dbus (receive, send)
   101  	bus=session
   102  	interface=org.gnome.evolution.dataserver.SourceManager
   103  	path=/org/gnome/evolution/dataserver/SourceManager
   104  	peer=(label=unconfined),
   105  
   106  # Allow clients to introspect the service
   107  dbus (send)
   108  	bus=session
   109  	interface=org.freedesktop.DBus.Introspectable
   110  	path=/org/gnome/evolution/dataserver/Calendar{,/**}
   111  	member=Introspect
   112  	peer=(label=unconfined),
   113  dbus (send)
   114  	bus=session
   115  	interface=org.freedesktop.DBus.Introspectable
   116  	path=/org/gnome/evolution/dataserver/CalendarFactory
   117  	member=Introspect
   118  	peer=(label=unconfined),
   119  dbus (send)
   120  	bus=session
   121  	interface=org.freedesktop.DBus.Introspectable
   122  	path=/org/gnome/evolution/dataserver/CalendarView{,/**}
   123  	member=Introspect
   124  	peer=(label=unconfined),
   125  dbus (send)
   126  	bus=session
   127  	interface=org.freedesktop.DBus.Introspectable
   128  	path=/org/gnome/evolution/dataserver/SourceManager{,/**}
   129  	member=Introspect
   130  	peer=(label=unconfined),
   131  `
   132  
   133  func init() {
   134  	registerIface(&commonInterface{
   135  		name:                  "calendar-service",
   136  		summary:               calendarServiceSummary,
   137  		implicitOnClassic:     !(release.ReleaseInfo.ID == "ubuntu" && release.ReleaseInfo.VersionID == "14.04"),
   138  		reservedForOS:         true,
   139  		baseDeclarationSlots:  calendarServiceBaseDeclarationSlots,
   140  		connectedPlugAppArmor: calendarServiceConnectedPlugAppArmor,
   141  	})
   142  }