Merge pull request #1 from endlessm/T23858-accounts-service

T23858 Add app-filter storage in accounts service
This commit is contained in:
Philip Withnall 2018-09-28 10:14:23 +02:00 committed by GitHub
commit 908f77b895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 138 additions and 0 deletions

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="com.endlessm.ParentalControls.AppFilter">
<annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
<annotation name="org.freedesktop.Accounts.Authentication.ChangeOwn"
value="com.endlessm.ParentalControls.AppFilter.ChangeOwn"/>
<annotation name="org.freedesktop.Accounts.Authentication.ReadOwn"
value="com.endlessm.ParentalControls.AppFilter.ReadOwn"/>
<annotation name="org.freedesktop.Accounts.Authentication.ChangeAny"
value="com.endlessm.ParentalControls.AppFilter.ChangeAny"/>
<annotation name="org.freedesktop.Accounts.Authentication.ReadAny"
value="com.endlessm.ParentalControls.AppFilter.ReadAny"/>
<!--
app-filter:
A filter for which applications and binaries the user can run. This is
intended to be set by administrators and read by users, rather than being
editable by the user themselves.
The string list contains flatpak application IDs (containing at least one
dot and no leading slash) and absolute binary paths (containing a leading
slash). The boolean value indicates whether this is a whitelist (true) or
blacklist (false).
-->
<property name="app-filter" type="(bas)" access="readwrite">
<annotation name="org.freedesktop.Accounts.DefaultValue"
value="(false, [])"/>
</property>
</interface>
</node>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<policyconfig>
<action id="com.endlessm.ParentalControls.AppFilter.ChangeOwn">
<description>Change your own app filter</description>
<message>Authentication is required to change your app filter.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="com.endlessm.ParentalControls.AppFilter.ReadOwn">
<description>Read your own app filter</description>
<message>Authentication is required to read your app filter.</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>
<action id="com.endlessm.ParentalControls.AppFilter.ChangeAny">
<description>Change another users app filter</description>
<message>Authentication is required to change another users app filter.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
<action id="com.endlessm.ParentalControls.AppFilter.ReadAny">
<description>Read another users app filter</description>
<message>Authentication is required to read another users app filter.</message>
<defaults>
<allow_any>auth_admin_keep</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
</policyconfig>

View File

@ -0,0 +1,13 @@
i18n.merge_file('com.endlessm.ParentalControls.policy',
input: 'com.endlessm.ParentalControls.policy.in',
output: 'com.endlessm.ParentalControls.policy',
po_dir: po_dir,
install: true,
install_dir: polkitpolicydir,
)
install_data('com.endlessm.ParentalControls.AppFilter.xml',
install_dir: dbusinterfacesdir)
meson.add_install_script(meson_make_symlink,
join_paths(dbusinterfacesdir, 'com.endlessm.ParentalControls.AppFilter.xml'),
join_paths(accountsserviceinterfacesdir, 'com.endlessm.ParentalControls.AppFilter.xml'))

32
meson.build Normal file
View File

@ -0,0 +1,32 @@
project('eos-parental-controls', 'c',
version : '0.1.0',
meson_version : '>= 0.47.0',
license: 'LGPLv2.1+',
default_options : [
'buildtype=debugoptimized',
'warning_level=2',
'c_std=gnu11',
]
)
i18n = import('i18n')
pkgconfig = import('pkgconfig')
meson_make_symlink = join_paths(meson.source_root(), 'tools', 'meson-make-symlink.sh')
po_dir = join_paths(meson.source_root(), 'po')
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
# FIXME: This isnt exposed in accountsservice.pc
accountsserviceinterfacesdir = join_paths(datadir, 'accountsservice', 'interfaces')
dbus = dependency('dbus-1')
dbusinterfacesdir = dbus.get_pkgconfig_variable('interfaces_dir',
define_variable: ['datadir', datadir])
polkit_gobject = dependency('polkit-gobject-1')
polkitpolicydir = polkit_gobject.get_pkgconfig_variable('policydir',
define_variable: ['prefix', prefix])
subdir('accounts-service')

0
po/LINGUAS Normal file
View File

3
po/POTFILES.in Normal file
View File

@ -0,0 +1,3 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
accounts-service/com.endlessm.ParentalControls.policy

1
po/meson.build Normal file
View File

@ -0,0 +1 @@
i18n.gettext('eos-parental-controls', preset: 'glib')

12
tools/meson-make-symlink.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -eu
# this is needed mostly because $DESTDIR is provided as a variable,
# and we need to create the target directory...
mkdir -vp "$(dirname "${DESTDIR:-}$2")"
if [ "$(dirname $1)" = . ]; then
ln -vfs -T "$1" "${DESTDIR:-}$2"
else
ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
fi