# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{lib}/gsd-disk-utility-notify
@{att} = /att/gsd-disk-utility-notify/
profile gsd-disk-utility-notify /{,usr/}lib{,exec,32,64}/gsd-disk-utility-notify  flags=(attach_disconnected,attach_disconnected.path=@{att},complain) {
  include <abstractions/attached/base>
  include <abstractions/bus-session>
  include <abstractions/bus-system>
  include <abstractions/bus/org.freedesktop.UDisks2>

  include <abstractions/bus/session/own>

  dbus bind bus=session name=org.gnome.Disks.NotificationMonitor{,.*},
  dbus receive bus=session path=/org/gnome/Disks/NotificationMonitor{,/**}
       interface=org.gnome.Disks.NotificationMonitor{,.*}
       peer=(name="@{busname}"),
  dbus send bus=session path=/org/gnome/Disks/NotificationMonitor{,/**}
       interface=org.gnome.Disks.NotificationMonitor{,.*}
       peer=(name="{@{busname},org.freedesktop.DBus}"),
  dbus (send receive) bus=session path=/org/gnome/Disks/NotificationMonitor{,/**}
       interface=org.freedesktop.DBus.Properties
       member={Get,GetAll,Set,PropertiesChanged}
       peer=(name="{@{busname},org.freedesktop.DBus}"),
  dbus receive bus=session path=/org/gnome/Disks/NotificationMonitor{,/**}
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name="@{busname}"),
  dbus receive bus=session path=/org/gnome/Disks/NotificationMonitor{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name="{@{busname},org.gnome.Disks.NotificationMonitor{,.*}}"),
  dbus send bus=session path=/org/gnome/Disks/NotificationMonitor{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member={InterfacesAdded,InterfacesRemoved}
       peer=(name="{@{busname},org.freedesktop.DBus}"),
  unix type=stream addr=none peer=(label=udisksd, addr=none),

  dbus (send receive) bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.UDisks2{,.*}
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus (send receive) bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.Properties
       member={Get,GetAll,Set,PropertiesChanged}
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus send bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus send bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),
  dbus receive bus=system path=/org/freedesktop/UDisks2{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member={InterfacesAdded,InterfacesRemoved}
       peer=(name="{@{busname},org.freedesktop.UDisks2{,.*}}", label=udisksd),

  dbus receive bus=session
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name=:*, label=gnome-shell),

  @{exec_path} mr,

  include if exists <local/gsd-disk-utility-notify>
}

# vim:syntax=apparmor
