From a38917ab266373b693af215a8f27cac64e559994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 3 Dec 2020 18:59:05 +0100 Subject: [PATCH] fprintd: Re-order permissions table by priority and add docs Given that we could do operations where at least one permission, is requested, we should give more priority to the weaker ones that are acceptable and in case raise the level at later points. --- src/fprintd.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/fprintd.h b/src/fprintd.h index eef6644..fd8b9b1 100644 --- a/src/fprintd.h +++ b/src/fprintd.h @@ -53,11 +53,16 @@ typedef enum { FPRINT_ERROR_NO_SUCH_DEVICE, /*< nick=net.reactivated.Fprint.Error.NoSuchDevice >*/ } FprintError; +/* Enum of possible permissions, orders and nick matter here: + - The order controls the priority of a required permission when various are + accepted: the lowest the value, the more priorty it has. + - Nick must match the relative polkit rule. +*/ typedef enum { FPRINT_DEVICE_PERMISSION_NONE = 0, - FPRINT_DEVICE_PERMISSION_ENROLL = (1 << 0), /*< nick=net.reactivated.fprint.device.enroll >*/ - FPRINT_DEVICE_PERMISSION_SETUSERNAME = (1 << 1), /*< nick=net.reactivated.fprint.device.setusername >*/ - FPRINT_DEVICE_PERMISSION_VERIFY = (1 << 2), /*< nick=net.reactivated.fprint.device.verify >*/ + FPRINT_DEVICE_PERMISSION_VERIFY = (1 << 0), /*< nick=net.reactivated.fprint.device.verify >*/ + FPRINT_DEVICE_PERMISSION_ENROLL = (1 << 1), /*< nick=net.reactivated.fprint.device.enroll >*/ + FPRINT_DEVICE_PERMISSION_SETUSERNAME = (1 << 2), /*< nick=net.reactivated.fprint.device.setusername >*/ } FprintDevicePermission; /* Manager */