Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
S
scom
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
scom
Commits
2f668c7f
Kaydet (Commit)
2f668c7f
authored
Kas 02, 2008
tarafından
Bahadır Kandemir
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
PolKit support
üst
264fdbb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
__init__.py
api/comar/__init__.py
+25
-2
No files found.
api/comar/__init__.py
Dosyayı görüntüle @
2f668c7f
...
...
@@ -9,9 +9,10 @@
# option) any later version. Please read the COPYING file.
#
__version__
=
'2.1.
0
'
__version__
=
'2.1.
1
'
import
dbus
import
os
class
Call
:
def
__init__
(
self
,
link
,
group
,
class_
=
None
,
package
=
None
,
method
=
None
):
...
...
@@ -60,6 +61,10 @@ class Call:
def
handleResult
(
*
result
):
self
.
async
(
self
.
package
,
None
,
result
)
def
handleError
(
exception
):
if
"policy.auth"
in
exception
.
_dbus_error_name
:
action
=
exception
.
get_dbus_message
()
if
self
.
queryPolicyKit
(
action
):
return
self
.
call
(
*
args
,
**
kwargs
)
self
.
async
(
self
.
package
,
exception
,
None
)
if
self
.
quiet
:
...
...
@@ -106,10 +111,28 @@ class Call:
if
self
.
package
:
obj
=
self
.
link
.
bus
.
get_object
(
self
.
link
.
address
,
"/package/
%
s"
%
self
.
package
,
introspect
=
False
)
met
=
getattr
(
obj
,
self
.
method
)
return
met
(
dbus_interface
=
"tr.org.pardus.comar.
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
*
args
)
try
:
return
met
(
dbus_interface
=
"tr.org.pardus.comar.
%
s.
%
s"
%
(
self
.
group
,
self
.
class_
),
*
args
)
except
dbus
.
DBusException
,
e
:
if
"policy.auth"
in
e
.
_dbus_error_name
:
action
=
e
.
get_dbus_message
()
if
self
.
queryPolicyKit
(
action
):
return
self
.
call
(
*
args
,
**
kwargs
)
raise
dbus
.
DBusException
,
e
else
:
raise
AttributeError
,
"Package name required for non-async calls."
def
queryPolicyKit
(
self
,
action
):
if
"DISPLAY"
not
in
os
.
environ
:
raise
Exception
,
"X session required to query PolKit"
bus
=
dbus
.
SessionBus
()
obj
=
bus
.
get_object
(
"org.freedesktop.PolicyKit.AuthenticationAgent"
,
"/"
)
iface
=
dbus
.
Interface
(
obj
,
"org.freedesktop.PolicyKit.AuthenticationAgent"
)
try
:
return
iface
.
ObtainAuthorization
(
action
,
0
,
os
.
getpid
(),
timeout
=
2
**
16
-
1
)
==
1
except
:
return
False
class
Link
:
def
__init__
(
self
,
address
=
"tr.org.pardus.comar"
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment