malcontent/libmalcontent/session-limits-private.h
Philip Withnall 5e49cb7831 libmalcontent: Add a SessionLimits interface for time-limited sessions
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>
2020-01-16 13:17:45 +00:00

63 lines
1.8 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>
#include <libmalcontent/session-limits.h>
G_BEGIN_DECLS
/**
* MctSessionLimitsType:
* @MCT_SESSION_LIMITS_TYPE_NONE: No session limits are imposed.
* @MCT_SESSION_LIMITS_TYPE_DAILY_SCHEDULE: Sessions are limited to between a
* pair of given times each day.
*
* Types of session limit which can be imposed on an account. Additional types
* may be added in future.
*
* Since: 0.5.0
*/
typedef enum
{
/* these values are used in the com.endlessm.ParentalControls.SessionLimits
* D-Bus interface, so must not be changed */
MCT_SESSION_LIMITS_TYPE_NONE = 0,
MCT_SESSION_LIMITS_TYPE_DAILY_SCHEDULE = 1,
} MctSessionLimitsType;
struct _MctSessionLimits
{
gint ref_count;
uid_t user_id;
MctSessionLimitsType limit_type;
guint daily_start_time; /* seconds since midnight */
guint daily_end_time; /* seconds since midnight */
};
G_END_DECLS