You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by gs...@apache.org on 2025/10/07 23:22:34 UTC
(steve) 03/03: Add endpoints to open/close an Election.
This is an automated email from the ASF dual-hosted git repository.
gstein pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git
commit 3f167e66b3bb1413cb5236a9e24b928b07dd9255
Author: Greg Stein <gs...@gmail.com>
AuthorDate: Tue Oct 7 18:22:17 2025 -0500
Add endpoints to open/close an Election.
---
v3/server/pages.py | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/v3/server/pages.py b/v3/server/pages.py
index 9369bbf..5bf3702 100644
--- a/v3/server/pages.py
+++ b/v3/server/pages.py
@@ -201,6 +201,43 @@ async def manage_page(election):
return result
+@APP.get('/do-open/<eid>')
+@asfquart.auth.require({R.committer}) ### need general solution
+@load_election
+async def do_open_endpoint(election):
+ result = await signin_info()
+
+ ### check authz
+
+ _LOGGER.info(f'Opening election[E:{election.eid}]')
+
+ ### should open/keep a PersonDB instance in the APP
+ pdb = steve.persondb.PersonDB(DB_FNAME)
+
+ # Open the Election.
+ election.open(pdb)
+
+ # Return to the management page for this Election.
+ return quart.redirect(f'/manage/{election.eid}')
+
+
+@APP.get('/do-close/<eid>')
+@asfquart.auth.require({R.committer}) ### need general solution
+@load_election
+async def do_close_endpoint(election):
+ result = await signin_info()
+
+ ### check authz
+
+ _LOGGER.info(f'Closing election[E:{election.eid}]')
+
+ # Close the Election.
+ election.close()
+
+ # Return to the management page for this Election.
+ return quart.redirect(f'/manage/{election.eid}')
+
+
@APP.get('/profile')
@asfquart.auth.require # Bare decorator means just require a valid session
@APP.use_template(TEMPLATES / 'profile.ezt')