diff options
author | Pavel Šimerda <psimerda@redhat.com> | 2015-01-02 21:20:38 +0100 |
---|---|---|
committer | Pavel Šimerda <psimerda@redhat.com> | 2015-01-05 18:38:22 +0100 |
commit | 5fb31ba5d1c54ae9bf723e20fb1e4a83cf2a0496 (patch) | |
tree | 5191dfdd4b1b6a80a906e257a950c9fe1e901795 /src/nm-session-monitor.c | |
parent | 335bbc63357cc963628ad97f465433d1936fe0ba (diff) |
session: switch code to nm_session_monitor_session_exists()
Acked-By: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'src/nm-session-monitor.c')
-rw-r--r-- | src/nm-session-monitor.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nm-session-monitor.c b/src/nm-session-monitor.c index d398056e6..c9ee3426f 100644 --- a/src/nm-session-monitor.c +++ b/src/nm-session-monitor.c @@ -65,3 +65,25 @@ nm_session_monitor_user_to_uid (const char *user, uid_t *out_uid) return TRUE; } + +/** + * nm_session_monitor_session_exists: + * @uid: A user ID. + * @active: Ignore inactive sessions. + * + * Checks whether the given @uid is logged into an active session. Don't + * use this feature for security purposes. It is there just to allow you + * to prefer an agent from an active session over an agent from an + * inactive one. + * + * Returns: %FALSE if @error is set otherwise %TRUE if the given @uid is + * logged into an active session. + */ +gboolean +nm_session_monitor_session_exists (uid_t uid, gboolean active) +{ + if (active) + return nm_session_monitor_uid_active (nm_session_monitor_get (), uid, NULL); + else + return nm_session_monitor_uid_has_session (nm_session_monitor_get (), uid, NULL, NULL); +} |