Re: Problem to add a broadband connection on NetworkManagerUserSettings
- From: Jirka Klimes <jklimes redhat com>
- To: networkmanager-list gnome org
- Cc: Maxwell Chiareli Xandeco <maxwell xandeco br flextronics com>
- Subject: Re: Problem to add a broadband connection on NetworkManagerUserSettings
- Date: Wed, 13 Jan 2010 14:07:49 +0100
On Tuesday 12 January 2010 16:36:07 Maxwell Chiareli Xandeco wrote:
> Hi all,
>
> I trying to add a new broadband connection using dbus python API:
>
> settings = dbus.Dictionary({dbus.String(u'connection'):
> dbus.Dictionary({dbus.String(u'timestamp'): dbus.UInt64(1263301788L,
> variant_level=1), dbus.String(u'autoconnect'): dbus.Boolean(False,
> variant_level=1), dbus.String(u'type'): dbus.String(u'gsm',
> variant_level=1), dbus.String(u'uuid'):
> dbus.String(u'8a0e02d9-9b1a-463b-a089-7a68140bf4c3', variant_level=1),
> dbus.String(u'id'): dbus.String(u'Vivo Default', variant_level=1)},
> signature=dbus.Signature('sv')), dbus.String(u'ppp'):
> dbus.Dictionary({}, signature=dbus.Signature('sv')),
> dbus.String(u'gsm'): dbus.Dictionary({dbus.String(u'username'):
> dbus.String(u'vivo', variant_level=1), dbus.String(u'band'):
> dbus.Int32(0, variant_level=1), dbus.String(u'apn'):
> dbus.String(u'zap.vivo.com.br', variant_level=1),
> dbus.String(u'number'): dbus.String(u'*99#', variant_level=1)},
> signature=dbus.Signature('sv')), dbus.String(u'serial'):
> dbus.Dictionary({dbus.String(u'baud'): dbus.UInt32(115200L,
> variant_level=1)}, signature=dbus.Signature('sv'))},
> signature=dbus.Signature('sa{sv}'))
>
> sys_bus = dbus.SystemBus()
> proxy = sys_bus.get_object("org.freedesktop.NetworkManagerUserSettings",
> "/org/freedesktop/NetworkManagerSettings")
> proxy.AddConnection(settings)
>
> When I run this code i get a access denied error:
>
> dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied:
> Rejected send message, 2 matched rules; type="method_call",
> sender=":1.210" (uid=0 pid=27292 comm="python) interface="(unset)"
> member="AddConnection" error name="(unset)" requested_reply=0
> destination=":1.106" (uid=1000 pid=10148 comm="nm-applet))
>
> Does someone have any idea?
>
> Maxwell
>
The error says that you don't have permissions.
It's caused by not specifying interface which the method AddConnection should
be called on.
so do:
sys_bus = dbus.SystemBus()
proxy = sys_bus.get_object("org.freedesktop.NetworkManagerUserSettings",
"/org/freedesktop/NetworkManagerSettings")
iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
iface.AddConnection(settings)
Btw, what distribution do you use and what policies do you have in
/etc/dbus-1/system.d/nm-applet.conf ?
Jirka
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]