Malcontent.SessionLimits¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Malcontent.SessionLimits¶
Malcontent.SessionLimits
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.
New in version 0.5.0.
- classmethod deserialize(variant, user_id)¶
- Parameters:
variant (
GLib.Variant
) – a serialized session limits variantuser_id (
int
) – the ID of the user the session limits relate to
- Raises:
- Returns:
deserialized session limits
- Return type:
Deserialize a set of session limits previously serialized with
Malcontent.SessionLimits.serialize
(). This function guarantees to be able to deserialize any serialized form from this version or older versions of libmalcontent.If deserialization fails,
Malcontent.ManagerError.INVALID_DATA
will be returned.New in version 0.7.0.
- check_time_remaining(now_usecs)¶
- Parameters:
now_usecs (
int
) – current time as microseconds since the Unix epoch (UTC), typically queried usingGLib.get_real_time
()- Returns:
True
if the user this self corresponds to is allowed to be in an active session at the given time;False
otherwise- time_remaining_secs_out:
return location for the number of seconds remaining before the user’s session has to end, if limits are in force
- time_limit_enabled_out:
return location for whether time limits are enabled for this user
- Return type:
(
bool
, time_remaining_secs_out:int
, time_limit_enabled_out:bool
)
Check whether the user has time remaining in which they are allowed to use the computer, assuming that now_usecs is the current time, and applying the session limit policy from self to it.
This will return whether the user is allowed to use the computer now; further information about the policy and remaining time is provided in time_remaining_secs_out and time_limit_enabled_out.
New in version 0.5.0.
- get_user_id()¶
- Returns:
user ID of the relevant user, or
(uid_t) -1
if unknown- Return type:
Get the user ID of the user this
Malcontent.SessionLimits
is for.New in version 0.5.0.
- is_enabled()¶
- Returns:
True
if the session limits object contains at least one restrictive session limit,False
if there are no limits in place- Return type:
Check whether any session limits are enabled and are going to impose at least one restriction on the user. This gives a high level view of whether session limit parental controls are ‘enabled’ for the given user.
This function is equivalent to the value returned by the
time_limit_enabled_out
argument ofMalcontent.SessionLimits.check_time_remaining
().New in version 0.7.0.
- ref()¶
- Returns:
the same pointer as self
- Return type:
Increment the reference count of self, and return the same pointer to it.
New in version 0.5.0.
- serialize()¶
- Returns:
a new, floating
GLib.Variant
containing the session limits- Return type:
Build a
GLib.Variant
which contains the session limits from self, in an opaque variant format. This format may change in future, butMalcontent.SessionLimits.deserialize
() is guaranteed to always be able to load any variant produced by the current or any previous version ofMalcontent.SessionLimits.serialize
().New in version 0.7.0.
- unref()¶
Decrement the reference count of self. If the reference count reaches zero, free the self and all its resources.
New in version 0.5.0.