This is another extension interface on accountsservice which stores information about time and usage limits on the user session. Currently, only a ‘daily schedule’ limit (or no limit) is supported, but additional types and combinations of limits can be supported in future. The daily schedule limit allows using the computer between a certain start time and end time each day (the same each day). The user will be kicked out of their session when the end time is reached, if they haven’t already logged out. This includes the getters for the new data, polkit rules for accessing it, and some documentation. Changes to `malcontent-client` to support session limits, setters, and unit tests will all follow. Signed-off-by: Philip Withnall <withnall@endlessm.com>
59 lines
2.2 KiB
C
59 lines
2.2 KiB
C
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
*
|
|
* Copyright © 2019 Endless Mobile, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*
|
|
* Authors:
|
|
* - Philip Withnall <withnall@endlessm.com>
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <gio/gio.h>
|
|
#include <glib.h>
|
|
#include <glib-object.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/**
|
|
* MctSessionLimits:
|
|
*
|
|
* #MctSessionLimits is an opaque, immutable structure which contains a snapshot
|
|
* of the session limits settings for a user at a given time. This includes
|
|
* whether session limits are being enforced, and the limit policy — for
|
|
* example, the times of day when a user is allowed to use the computer.
|
|
*
|
|
* Typically, session limits settings can only be changed by the administrator,
|
|
* and are read-only for non-administrative users. The precise policy is set
|
|
* using polkit.
|
|
*
|
|
* Since: 0.5.0
|
|
*/
|
|
typedef struct _MctSessionLimits MctSessionLimits;
|
|
GType mct_session_limits_get_type (void);
|
|
|
|
MctSessionLimits *mct_session_limits_ref (MctSessionLimits *limits);
|
|
void mct_session_limits_unref (MctSessionLimits *limits);
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MctSessionLimits, mct_session_limits_unref)
|
|
|
|
uid_t mct_session_limits_get_user_id (MctSessionLimits *limits);
|
|
gboolean mct_session_limits_check_time_remaining (MctSessionLimits *limits,
|
|
guint64 now_usecs,
|
|
guint64 *time_remaining_secs_out,
|
|
gboolean *time_limit_enabled_out);
|
|
|
|
G_END_DECLS
|