Permalink
Browse files

Make options case sensitive

  • Loading branch information...
Bahadır Kandemir
Bahadır Kandemir committed May 5, 2010
1 parent a3334c3 commit 65049293f91687cbd4bd7da35cfb25b68ff87e5c
Showing with 11 additions and 4 deletions.
  1. +9 −2 polkit.py
  2. +2 −2 test.py
View
@@ -102,6 +102,7 @@ def auth_list_all():
authorizations = []
cp = ConfigParser.ConfigParser()
+ cp.optionxform = str
cp.read(DB_FILE)
for title in cp.sections():
@@ -146,11 +147,13 @@ def auth_add(action_id, auth_type, uid, pid=None):
user = pwd.getpwuid(uid).pw_name
cp = ConfigParser.ConfigParser()
+ cp.optionxform = str
cp.read(DB_FILE)
if "user:%s:allow" % user in cp.sections():
actions = cp.get("user:%s:allow" % user, "Action").split(":")
- actions.append(action_id)
+ if action_id not in actions:
+ actions.append(action_id)
cp.set("user:%s:allow" % user, "Action", ":".join(actions))
else:
actions = [action_id]
@@ -174,6 +177,7 @@ def auth_revoke_all(uid):
"""
cp = ConfigParser.ConfigParser()
+ cp.optionxform = str
cp.read(DB_FILE)
user = pwd.getpwuid(uid).pw_name
@@ -199,6 +203,7 @@ def auth_revoke(uid, action_id):
"""
cp = ConfigParser.ConfigParser()
+ cp.optionxform = str
cp.read(DB_FILE)
user = pwd.getpwuid(uid).pw_name
@@ -230,11 +235,13 @@ def auth_block(uid, action_id):
user = pwd.getpwuid(uid).pw_name
cp = ConfigParser.ConfigParser()
+ cp.optionxform = str
cp.read(DB_FILE)
if "user:%s:deny" % user in cp.sections():
actions = cp.get("user:%s:deny" % user, "Action").split(":")
- actions.append(action_id)
+ if action_id not in actions:
+ actions.append(action_id)
cp.set("user:%s:deny" % user, "Action", ":".join(actions))
else:
actions = [action_id]
View
@@ -1,4 +1,4 @@
import polkit
-print polkit.auth_list_all()
-#polkit.auth_block(1000, "tr.org.pardus.comar.net.link.set")
+#print polkit.auth_list_all()
+polkit.auth_add("tr.org.pardus.comar.net.link.set", None, 1000, None)

0 comments on commit 6504929

Please sign in to comment.