File: policy_kit.ml

package info (click to toggle)
obus 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,480 kB
  • sloc: ml: 14,675; lisp: 52; makefile: 11; xml: 8
file content (21 lines) | stat: -rw-r--r-- 664 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(*
 * policy_kit.ml
 * -------------
 * Copyright : (c) 2010, Jeremie Dimino <jeremie@dimino.org>
 * Licence   : BSD3
 *
 * This file is a part of obus, an ocaml implementation of D-Bus.
 *)

let not_authorized = "org.freedesktop.PolicyKit.Error.NotAuthorized"

open Policy_kit_interfaces.Org_freedesktop_PolicyKit_AuthenticationAgent

let obtain_authorization ~action_id ?(xid=0) ~pid () =
  let%lwt session_bus = OBus_bus.session () in
  let proxy =
    OBus_proxy.make
      (OBus_peer.make session_bus "org.freedesktop.PolicyKit.AuthenticationAgent")
      []
  in
  OBus_method.call m_ObtainAuthorization proxy (action_id, Int32.of_int xid, Int32.of_int pid)