From 1d7384169382a29fc82274330643ce271c45c84e Mon Sep 17 00:00:00 2001 From: Michael Ellis Date: Fri, 18 Jun 2010 21:03:17 -0400 Subject: [PATCH] No more office/syscom entries. Check if group is valid --- ceo/members.py | 9 +++++++++ ceo/urwid/groups.py | 26 ++++++++++++++++++-------- ceo/urwid/main.py | 14 -------------- debian/changelog | 7 +++++++ 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/ceo/members.py b/ceo/members.py index 8698957..be212f6 100644 --- a/ceo/members.py +++ b/ceo/members.py @@ -232,6 +232,15 @@ def get(userid): return ldapi.lookup(ld, 'uid', userid, cfg['ldap_users_base']) +def get_group(group): + """ + Look up group by groupname + + Returns a dictionary of group attributes + """ + + return ldapi.lookup(ld, 'cn', group, cfg['ldap_groups_base']) + def uid2dn(uid): return 'uid=%s,%s' % (ldapi.escape(uid), cfg['ldap_users_base']) diff --git a/ceo/urwid/groups.py b/ceo/urwid/groups.py index 1b27d9b..7fa93fe 100644 --- a/ceo/urwid/groups.py +++ b/ceo/urwid/groups.py @@ -37,11 +37,7 @@ class IntroPage(WizardPanel): urwid.Text( "Adding a member to a club will also grant them " "access to the club's files and allow them to " "become_club." - "\n\n" - "Do not manage office and syscom related groups using " - "this interface. Instead use the \"Manage Office " - "Staff\" and \"Manage Systems Committee\" entries " - "from the main menu." ) + "\n\n") ] def focusable(self): return False @@ -57,13 +53,27 @@ class InfoPage(WizardPanel): ] def check(self): group = self.group.get_edit_text() - # TODO - check that group is valid - group_name = group # TODO + + # check if group is valid + if not group or not members.get_group(group): + set_status("Group not found") + self.focus_widget(self.group) + return True + data = { "name" : group, - "group" : group_name, + "group" : group, "groups" : [], } + + # Office Staff and Syscom get added to more groups + if group == "syscom": + data["name"] = "Systems Committee" + data["groups"] = [ "office", "staff", "adm", "src" ] + elif group == "office": + data["name"] = "Office Staff" + data["groups"] = [ "cdrom", "audio", "video", "www" ] + group_members(data) class ChangeMember(WizardPanel): diff --git a/ceo/urwid/main.py b/ceo/urwid/main.py index 3417667..1fb18c9 100644 --- a/ceo/urwid/main.py +++ b/ceo/urwid/main.py @@ -30,18 +30,6 @@ def program_name(): return "%s %s %s" % (cword, eword, oword) -office_data = { - "name" : "Office Staff", - "group" : "office", - "groups" : [ "cdrom", "audio", "video", "www" ], -} - -syscom_data = { - "name" : "Systems Committee", - "group" : "syscom", - "groups" : [ "office", "staff", "adm", "src" ], -} - def new_member(*args, **kwargs): push_wizard("New Member", [ newmember.IntroPage, @@ -159,8 +147,6 @@ def top_menu(): syscom_only = [ ("Manage Club or Group Members", manage_group, None), ("Manage Positions", manage_positions, None), - ("Manage Office Staff", groups.group_members, office_data), - ("Manage Systems Committee", groups.group_members, syscom_data), ] unrestricted = [ ("Display Member", display_member, None), diff --git a/debian/changelog b/debian/changelog index 4bf777a..df22085 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ceo (0.5.7+nmu2) stable; urgency=low + + * Removed the need for separate entries to manage office and syscom + * Added check to ensure group is valid + + -- Michael Ellis Fri, 18 Jun 2010 20:59:40 -0400 + ceo (0.5.7+nmu1) stable; urgency=low * Non-maintainer upload.