github.com/bugraaydogar/snapd@v0.0.0-20210315170335-8c70bb858939/interfaces/builtin/accounts_service.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2017 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  const accountsServiceSummary = `allows communication with the Accounts service like GNOME Online Accounts`
    23  
    24  const accountsServiceBaseDeclarationSlots = `
    25    accounts-service:
    26      allow-installation:
    27        slot-snap-type:
    28          - core
    29      deny-auto-connection: true
    30  `
    31  
    32  const accountsServiceConnectedPlugAppArmor = `
    33  # Description: Allow access to Accounts service like GNOME Online Accounts
    34  
    35  #include <abstractions/dbus-session-strict>
    36  
    37  # Allow use of ObjectManager APIs, used to enumerate accounts
    38  dbus (receive, send)
    39      bus=session
    40      interface=org.freedesktop.DBus.ObjectManager
    41      path=/org/gnome/OnlineAccounts
    42      peer=(label=unconfined),
    43  
    44  # Allow getting/setting properties on accounts
    45  dbus (receive, send)
    46      bus=session
    47      interface=org.freedesktop.DBus.Properties
    48      path=/org/gnome/OnlineAccounts{,/**}
    49      peer=(label=unconfined),
    50  
    51  # Allow use of all OnlineAccounts methods
    52  dbus (receive, send)
    53      bus=session
    54      interface=org.gnome.OnlineAccounts.*
    55      path=/org/gnome/OnlineAccounts{,/**}
    56      peer=(label=unconfined),
    57  
    58  # Allow clients to introspect the service
    59  # do not use peer=(label=unconfined) here since this is DBus activated
    60  dbus (receive, send)
    61      bus=session
    62      interface=org.freedesktop.DBus.Properties
    63      path=/org/gnome/OnlineAccounts{,/**}
    64      member="Get{,All}",
    65  dbus (send)
    66      bus=session
    67      interface=org.freedesktop.DBus.Introspectable
    68      path=/com/ubuntu/OnlineAccounts{,/**}
    69      member=Introspect,
    70  `
    71  
    72  func init() {
    73  	registerIface(&commonInterface{
    74  		name:                  "accounts-service",
    75  		summary:               accountsServiceSummary,
    76  		implicitOnClassic:     true,
    77  		baseDeclarationSlots:  accountsServiceBaseDeclarationSlots,
    78  		connectedPlugAppArmor: accountsServiceConnectedPlugAppArmor,
    79  	})
    80  }