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
0fad819c
Kaydet (Commit)
0fad819c
authored
Haz 04, 2009
tarafından
Bahadır Kandemir
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use polkit-auth
üst
5d0d275d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
14 deletions
+21
-14
ChangeLog
api/ChangeLog
+3
-0
README
api/README
+7
-2
__init__.py
api/comar/__init__.py
+11
-12
No files found.
api/ChangeLog
Dosyayı görüntüle @
0fad819c
2009-06-04 Bahadır Kandemir <bahadir@pardus.org.tr>
* api: Use polkit-auth
2009-05-11 Bahadır Kandemir <bahadir@pardus.org.tr>
* network: callScrip(profile, state) for executing profile scripts under
/etc/network/netlink.d/profilename.state
...
...
api/README
Dosyayı görüntüle @
0fad819c
...
...
@@ -31,6 +31,9 @@ Asynchronous calls:
# Localize strings
link.setLocale()
# Use authentication agent (GUI)
link.useAgent()
# Make an asynchronous call to get service information
def handler(package, exception, result):
if exception:
...
...
@@ -49,5 +52,7 @@ Connecting COMAR service on alternate destination:
This will simply try to connect tr.org.pardus.comar2 instead
of tr.org.pardus.comar
COMAR 3.0's primary destination is tr.org.pardus.comar3 and
alternate destination is tr.org.pardus.comar3.updated
Connecting to alternative DBus server:
import comar
link = comar.Link(socket="/mnt/target/var/run/dbus/system_bus_socket")
api/comar/__init__.py
Dosyayı görüntüle @
0fad819c
...
...
@@ -14,6 +14,7 @@ __version__ = '2.4.1'
import
dbus
import
locale
import
os
import
subprocess
class
Call
:
def
__init__
(
self
,
link
,
group
,
class_
=
None
,
package
=
None
,
method
=
None
):
...
...
@@ -128,18 +129,12 @@ class Call:
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
()
try
:
obj
=
bus
.
get_object
(
"org.freedesktop.PolicyKit.AuthenticationAgent"
,
"/"
)
except
dbus
.
DBusException
,
exception
:
return
False
iface
=
dbus
.
Interface
(
obj
,
"org.freedesktop.PolicyKit.AuthenticationAgent"
)
try
:
return
iface
.
ObtainAuthorization
(
action
,
0
,
os
.
getpid
(),
timeout
=
2
**
16
-
1
)
==
1
except
:
return
False
if
not
self
.
link
.
useAgent
:
os
.
environ
[
"POLKIT_AUTH_FORCE_TEXT"
]
=
"1"
ret
=
subprocess
.
call
([
"/usr/bin/polkit-auth"
,
"--obtain"
,
action
])
if
ret
==
0
:
return
True
return
False
class
Link
:
...
...
@@ -148,6 +143,7 @@ class Link:
self
.
address
=
"tr.org.pardus.comar"
self
.
interface
=
"tr.org.pardus.comar"
self
.
socket
=
socket
self
.
useAgent
=
False
if
not
socket
:
self
.
bus
=
dbus
.
SystemBus
()
...
...
@@ -157,6 +153,9 @@ class Link:
if
alternate
:
self
.
address
+=
"2"
def
useAgent
(
self
,
agent
=
True
):
self
.
useAgent
=
agent
def
setLocale
(
self
):
try
:
code
,
encoding
=
locale
.
getdefaultlocale
()
...
...
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