This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new a959ff9  Migrate another participation list to the storage interface
a959ff9 is described below

commit a959ff93d7fb2c65b142bb3aeea978dc8816c25a
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Jul 23 15:06:46 2025 +0100

    Migrate another participation list to the storage interface
---
 atr/routes/keys.py      | 12 +++++-------
 atr/storage/__init__.py |  4 ++++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/atr/routes/keys.py b/atr/routes/keys.py
index f899a7e..f25f521 100644
--- a/atr/routes/keys.py
+++ b/atr/routes/keys.py
@@ -463,15 +463,13 @@ async def update_committee_keys(session: 
routes.CommitterSession, committee_name
 @routes.committer("/keys/upload", methods=["GET", "POST"])
 async def upload(session: routes.CommitterSession) -> str:
     """Upload a KEYS file containing multiple OpenPGP keys."""
-    # Get committees for all projects the user is a member of
-    async with db.session() as data:
-        project_list = session.committees + session.projects
-        user_committees = await data.committee(name_in=project_list).all()
+    async with storage.write(session.uid) as write:
+        participant_of_committees = await write.participant_of_committees()
 
     class UploadKeyForm(UploadKeyFormBase):
         selected_committee = wtforms.SelectField(
             "Associate keys with committee",
-            choices=[(c.name, c.display_name) for c in user_committees if (not 
util.committee_is_standing(c.name))],
+            choices=[(c.name, c.display_name) for c in 
participant_of_committees],
             coerce=str,
             option_widget=wtforms.widgets.RadioInput(),
             widget=wtforms.widgets.ListWidget(prefix_label=False),
@@ -495,7 +493,7 @@ async def upload(session: routes.CommitterSession) -> str:
             await quart.flash(error, "error")
 
         # Determine which committee list to use
-        current_committees = all_user_committees if (all_user_committees is 
not None) else user_committees
+        current_committees = all_user_committees if (all_user_committees is 
not None) else participant_of_committees
         committee_map = {c.name: c.display_name for c in current_committees}
 
         return await template.render(
@@ -542,7 +540,7 @@ async def upload(session: routes.CommitterSession) -> str:
         )
         return await render(
             submitted_committees=[selected_committee],
-            all_user_committees=user_committees,
+            all_user_committees=participant_of_committees,
         )
 
     return await render()
diff --git a/atr/storage/__init__.py b/atr/storage/__init__.py
index 8e9ea6e..1adc9a7 100644
--- a/atr/storage/__init__.py
+++ b/atr/storage/__init__.py
@@ -209,6 +209,7 @@ class WriteAsCommitteeMember(WriteAsCommitteeParticipant):
 
 class Write:
     # Read and Write have authenticator methods which return access outcomes
+    # TODO: Still need to send some runtime credentials guarantee to the 
WriteAs* classes
     def __init__(self, data: db.Session, asf_uid: str | None, member_of: 
set[str], participant_of: set[str]):
         self.__data = data
         self.__asf_uid = asf_uid
@@ -255,6 +256,9 @@ class Write:
             return types.OutcomeException(e)
         return types.OutcomeResult(wafm)
 
+    # async def as_key_owner(self) -> types.Outcome[WriteAsKeyOwner]:
+    #     ...
+
     async def as_project_committee_member(self, project_name: str) -> 
types.Outcome[WriteAsCommitteeMember]:
         project = await self.__data.project(project_name, 
_committee=True).demand(
             AccessError(f"Project not found: {project_name}")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to