Skip to content

Commit

Permalink
Make options case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahadır Kandemir committed May 5, 2010
1 parent a3334c3 commit 6504929
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions polkit.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def auth_list_all():
authorizations = [] authorizations = []


cp = ConfigParser.ConfigParser() cp = ConfigParser.ConfigParser()
cp.optionxform = str
cp.read(DB_FILE) cp.read(DB_FILE)


for title in cp.sections(): for title in cp.sections():
Expand Down Expand Up @@ -146,11 +147,13 @@ def auth_add(action_id, auth_type, uid, pid=None):
user = pwd.getpwuid(uid).pw_name user = pwd.getpwuid(uid).pw_name


cp = ConfigParser.ConfigParser() cp = ConfigParser.ConfigParser()
cp.optionxform = str
cp.read(DB_FILE) cp.read(DB_FILE)


if "user:%s:allow" % user in cp.sections(): if "user:%s:allow" % user in cp.sections():
actions = cp.get("user:%s:allow" % user, "Action").split(":") 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)) cp.set("user:%s:allow" % user, "Action", ":".join(actions))
else: else:
actions = [action_id] actions = [action_id]
Expand All @@ -174,6 +177,7 @@ def auth_revoke_all(uid):
""" """


cp = ConfigParser.ConfigParser() cp = ConfigParser.ConfigParser()
cp.optionxform = str
cp.read(DB_FILE) cp.read(DB_FILE)


user = pwd.getpwuid(uid).pw_name user = pwd.getpwuid(uid).pw_name
Expand All @@ -199,6 +203,7 @@ def auth_revoke(uid, action_id):
""" """


cp = ConfigParser.ConfigParser() cp = ConfigParser.ConfigParser()
cp.optionxform = str
cp.read(DB_FILE) cp.read(DB_FILE)


user = pwd.getpwuid(uid).pw_name user = pwd.getpwuid(uid).pw_name
Expand Down Expand Up @@ -230,11 +235,13 @@ def auth_block(uid, action_id):
user = pwd.getpwuid(uid).pw_name user = pwd.getpwuid(uid).pw_name


cp = ConfigParser.ConfigParser() cp = ConfigParser.ConfigParser()
cp.optionxform = str
cp.read(DB_FILE) cp.read(DB_FILE)


if "user:%s:deny" % user in cp.sections(): if "user:%s:deny" % user in cp.sections():
actions = cp.get("user:%s:deny" % user, "Action").split(":") 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)) cp.set("user:%s:deny" % user, "Action", ":".join(actions))
else: else:
actions = [action_id] actions = [action_id]
Expand Down
4 changes: 2 additions & 2 deletions test.py
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
import polkit import polkit


print polkit.auth_list_all() #print polkit.auth_list_all()
#polkit.auth_block(1000, "tr.org.pardus.comar.net.link.set") polkit.auth_add("tr.org.pardus.comar.net.link.set", None, 1000, None)

0 comments on commit 6504929

Please sign in to comment.