Beispiel #1
0
gboolean
auth_check_sender_role (GDBusMethodInvocation *invocation,
                        const gchar *role)
{
  uid_t peer;
  if (!daemon_get_sender_uid (daemon_get (), invocation, &peer))
    return FALSE;
  if (!auth_check_uid_role (invocation, peer, role))
    return FALSE;
  return TRUE;
}
Beispiel #2
0
static gboolean
account_auth_check (CockpitAccount *object,
                    GDBusMethodInvocation *invocation,
                    Account *acc)
{
  uid_t peer;
  if (!daemon_get_sender_uid (daemon_get (), invocation, &peer))
    return FALSE;
  if (acc->u && act_user_get_uid (acc->u) == peer)
    return TRUE;
  if (!auth_check_uid_role (invocation, peer, COCKPIT_ROLE_USER_ADMIN))
    return FALSE;
  return TRUE;
}