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

abi <abi/4.0>,

include <tunables/global>

@{domain} = org.gnome.Maps
@{path} = org/gnome/Maps

@{exec_path} = @{bin}/gnome-maps /usr/share/gnome-maps/org.gnome.Maps
@{att} = /att/gnome-maps/
profile gnome-maps /{{,usr/}bin/gnome-maps,usr/share/gnome-maps/org.gnome.Maps} flags=(attach_disconnected,attach_disconnected.path=@{att}) {
  include <abstractions/attached/base>
  include <abstractions/common/gnome>
  include <abstractions/gjs>
  include <abstractions/attached/nameservice-strict>
  include <abstractions/network/netlink>
  include <abstractions/network/out/domain>
  include <abstractions/network/out/https>
  include <abstractions/p11-kit>
  include <abstractions/ssl_certs>

  #aa/dbus own bus=session name=org.gnome.Maps
  include <abstractions/bus/session/own>
  dbus bind bus=session name=org.gnome.Maps{,.*},
  dbus receive bus=session path=/org/gnome/Maps{,/**}
       interface=org.gnome.Maps{,.*}
       peer=(name="@{busname}"),
  dbus send bus=session path=/org/gnome/Maps{,/**}
       interface=org.gnome.Maps{,.*}
       peer=(name="{@{busname},org.freedesktop.DBus}"),
  # DBus.Properties: reply to properties request from anyone
  dbus (send receive) bus=session path=/org/gnome/Maps{,/**}
       interface=org.freedesktop.DBus.Properties
       member={Get,GetAll,Set,PropertiesChanged}
       peer=(name="{@{busname},org.freedesktop.DBus}"),
  # DBus.Introspectable: allow clients to introspect the service
  dbus receive bus=session path=/org/gnome/Maps{,/**}
       interface=org.freedesktop.DBus.Introspectable
       member=Introspect
       peer=(name="@{busname}"),
  # DBus.ObjectManager: allow clients to enumerate sources
  dbus receive bus=session path=/org/gnome/Maps{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member=GetManagedObjects
       peer=(name="{@{busname},org.gnome.Maps{,.*}}"),
  dbus send bus=session path=/org/gnome/Maps{,/**}
       interface=org.freedesktop.DBus.ObjectManager
       member={InterfacesAdded,InterfacesRemoved}
       peer=(name="{@{busname},org.freedesktop.DBus}"),


  @{exec_path} mr,

  @{open_path}  rpx -> child-open-help,

  owner @{user_pictures_dirs}/** rw,

  owner @{user_cache_dirs}/shumate/ rw,
  owner @{user_cache_dirs}/shumate/** rwlk,

  owner @{user_config_dirs}/shumate/ rw,
  owner @{user_config_dirs}/shumate/** rwlk,

  owner @{user_share_dirs}/shumate/ rw,
  owner @{user_share_dirs}/shumate/** rwlk,

  include if exists <local/gnome-maps>
}

# vim:syntax=apparmor
