diff --git a/fas/fas/group.py b/fas/fas/group.py index c04213d..929af42 100644 --- a/fas/fas/group.py +++ b/fas/fas/group.py @@ -126,7 +126,7 @@ class Group(controllers.Controller): turbogears.redirect('/group/list') return dict() else: - return dict(person=person, group=group) + return dict(group=group) @identity.require(turbogears.identity.not_anonymous()) @expose(template="fas.templates.group.new") @@ -243,12 +243,13 @@ class Group(controllers.Controller): re_search = re.sub(r'\*', r'%', search).lower() groups = Groups.query.filter(Groups.name.like(re_search)).order_by('name') - if groups.count() <= 0: + groups = filter(lambda group: canViewGroup(person, group), groups) + if len(groups) <= 0: turbogears.flash(_("No Groups found matching '%s'") % search) groups = {} if self.jsonRequest(): return ({'groups': groups}) - return dict(groups=groups, search=search, person=person) + return dict(groups=groups, search=search) @identity.require(turbogears.identity.not_anonymous()) @validate(validators=usernameGroupnameExists()) diff --git a/fas/fas/model.py b/fas/fas/model.py index 8ec46a8..81aa043 100644 --- a/fas/fas/model.py +++ b/fas/fas/model.py @@ -22,6 +22,7 @@ Model for the Fedora Account System ''' from datetime import datetime +from time import time from turbogears.database import metadata, mapper, get_engine # import some basic SQLAlchemy classes for declaring the data model # (see http://www.sqlalchemy.org/docs/04/ormtutorial.html) @@ -166,12 +167,12 @@ class People(SABase): def sponsor(cls, group, requester): # If we want to do logging, this might be the place. - # TODO: Find out how to log timestamp if not group in cls.memberships: raise '%s not a member of %s' % (group.name, cls.memberships) role = PersonRoles.query.filter_by(member=cls, group=group).one() role.role_status = 'approved' role.sponsor_id = requester.id + role.approval = time() def remove(cls, group, requester): role = PersonRoles.query.filter_by(member=cls, group=group).one() diff --git a/fas/fas/templates/group/list.html b/fas/fas/templates/group/list.html index 332338e..bd925ae 100644 --- a/fas/fas/templates/group/list.html +++ b/fas/fas/templates/group/list.html @@ -7,8 +7,10 @@ ${_('Groups List')} - - +

Create New Group

Create Group @@ -35,7 +37,6 @@ -
${group.name} ${ group.display_name } @@ -45,7 +46,6 @@ ${_('Apply')} -
diff --git a/fas/fas/templates/group/view.html b/fas/fas/templates/group/view.html index e5277ee..2689623 100644 --- a/fas/fas/templates/group/view.html +++ b/fas/fas/templates/group/view.html @@ -7,7 +7,11 @@ ${_('Edit Group')} - +

${group.display_name} (${group.name})

${_('My Status:')}