<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
SPDX-License-Identifier: LGPL-3.0-or-later
-->
<!-- -*- XML -*- -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
  <!-- Only @LINGLONG_USERNAME@ can own the service. Allow to invoke all methods -->
  <policy user="@LINGLONG_USERNAME@">
    <allow own="org.deepin.linglong.PackageManager1"/>
    <allow send_destination="org.deepin.linglong.PackageManager1"/>
    <allow receive_sender="org.deepin.linglong.PackageManager1"/>
  </policy>

  <policy context="default">
    <deny send_destination="org.deepin.linglong.PackageManager1"/>

    <!-- Completely open to anyone: org.freedesktop.DBus.* interfaces -->
    <allow send_destination="org.deepin.linglong.PackageManager1"
           send_interface="org.freedesktop.DBus.Peer"/>

    <allow send_destination="org.deepin.linglong.PackageManager1"
           send_interface="org.freedesktop.DBus.Properties"
           send_member="Get"/>

    <allow send_destination="org.deepin.linglong.PackageManager1"
           send_interface="org.freedesktop.DBus.Properties"
           send_member="GetAll"/>

    <!-- Allow anyone to invoke method Search -->
    <allow send_destination="org.deepin.linglong.PackageManager1"
           send_interface="org.deepin.linglong.PackageManager1" send_member="Search"/>

    <!-- Allow anyone to invoke method GenerateCache -->
    <allow send_destination="org.deepin.linglong.PackageManager1"
           send_interface="org.deepin.linglong.PackageManager1" send_member="GenerateCache"/>

  </policy>
  <!-- Allow root to invoke all methods -->
  <policy user="root">
  <allow send_destination="org.deepin.linglong.PackageManager1"/>
  <allow receive_sender="org.deepin.linglong.PackageManager1"/>
  </policy>
</busconfig>
