fedora_elections/__init__.py | 8 ++++++--
fedora_elections/models.py | 18 ++++++++++++++++++
files/fedora-elections.spec | 10 +++++++++-
3 files changed, 33 insertions(+), 3 deletions(-)
New commits:
commit 1e60b1b4bebda906044aab2dce70e223d26fbdd7
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 16 15:56:25 2014 +0200
Release 2.3
diff --git a/fedora_elections/__init__.py b/fedora_elections/__init__.py
index fc4f4c8..fd5f3e5 100644
--- a/fedora_elections/__init__.py
+++ b/fedora_elections/__init__.py
@@ -24,7 +24,7 @@
# Pierre-Yves Chibon <pingou(a)fedoraproject.org>
#
-__version__ = '2.2'
+__version__ = '2.3'
import os
diff --git a/files/fedora-elections.spec b/files/fedora-elections.spec
index 221b519..c1e9996 100644
--- a/files/fedora-elections.spec
+++ b/files/fedora-elections.spec
@@ -1,7 +1,7 @@
%define modname fedora_elections
Name: fedora-elections
-Version: 2.2
+Version: 2.3
Release: 1%{?dist}
Summary: Fedora elections application
@@ -109,6 +109,14 @@ install -m 644 files/update_1_to_2.sql \
%changelog
+* Wed Jul 16 2014 Pierre-Yves Chibon <pingou(a)pingoured.fr> - 2.3-1
+- Update to 2.3
+- Restrict the groups asked upon login (Allows Dennis to log in)
+- Check that candidates are FAS user when adding them to an election that
+ turned on the option
+- More links to the about page
+- Improved unit-tests suite
+
* Thu Jul 10 2014 Pierre-Yves Chibon <pingou(a)pingoured.fr> - 2.2-1
- Update to 2.2
- Better description of the different types of election
commit e5482acc2e59e523cd0b8b5e5faf3115f7801790
Merge: b2e5f17 d5167ef
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 16 15:44:05 2014 +0200
Merge pull request #32 from fedora-infra/restrict_groups
Restrict groups
commit d5167efe02be510e1645d6313e2ecfa57b39084f
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 16 09:19:46 2014 +0200
When login in, ask for the groups used in the database and admin groups set in the
configuration
diff --git a/fedora_elections/__init__.py b/fedora_elections/__init__.py
index 103cade..fc4f4c8 100644
--- a/fedora_elections/__init__.py
+++ b/fedora_elections/__init__.py
@@ -259,7 +259,11 @@ def auth_login():
if hasattr(flask.g, 'fas_user') and flask.g.fas_user is not None:
return safe_redirect_back(next_url)
else:
- return FAS.login(return_url=next_url)
+ groups = APP.config['FEDORA_ELECTIONS_ADMIN_GROUP'][:]
+ if isinstance(groups, basestring):
+ groups = [groups]
+ groups.extend(models.get_groups(SESSION))
+ return FAS.login(return_url=next_url, groups=groups)
@APP.route('/logout')
commit 0871db40e1c64562f23a95355ee3540e55b3e6e4
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Wed Jul 16 09:18:23 2014 +0200
Add a get_groups method that returns all the groups of interest in the database
These groups are the one used to restrict an election to a group of legal
voters or to specify a group as admin for an election.
We are interested in this list to ask OpenID to only return the groups
of interest rather than asking for all of them.
diff --git a/fedora_elections/models.py b/fedora_elections/models.py
index e0e5941..d35096f 100644
--- a/fedora_elections/models.py
+++ b/fedora_elections/models.py
@@ -415,3 +415,21 @@ class Vote(BASE):
stats['n_candidates'] = cnt
return stats
+
+
+def get_groups(session):
+ """ Return the list of groups of interest.
+
+ These groups are the groups used to find out the admins or the legal
+ voters of all the elections.
+ """
+
+ voters = [item[0] for item in session.query(
+ sa.distinct(LegalVoter.group_name)
+ ).order_by(LegalVoter.group_name).all()]
+
+ admins = [item[0] for item in session.query(
+ sa.distinct(ElectionAdminGroup.group_name)
+ ).order_by(ElectionAdminGroup.group_name).all()]
+
+ return voters + admins
Show replies by date