Skip to content

Commit c1f3888

Browse files
committed
update permissinos for /terms/{computing_id}
1 parent 58f4d34 commit c1f3888

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/officers/urls.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,21 @@ async def all_officers(
9999

100100
@router.get(
101101
"/terms/{computing_id}",
102-
description="""Get term info for an executive. All term info is public for all past or active terms.""",
102+
description="""
103+
Get term info for an executive. All term info is public for all past or active terms.
104+
Future terms can only be accessed by website admins.
105+
""",
103106
)
104107
async def get_officer_terms(
105108
request: Request,
106109
db_session: database.DBSession,
107110
computing_id: str,
108111
include_future_terms: bool = False
109112
):
110-
# TODO: should this be login-required if a user does not want to include future terms? The info is
111-
# supposed to all be public
112-
_, session_computing_id = await logged_in_or_raise(request, db_session)
113-
114-
if (
115-
computing_id != session_computing_id
116-
and include_future_terms
117-
):
118-
await WebsiteAdmin.has_permission_or_raise(db_session, session_computing_id)
113+
if include_future_terms:
114+
_, session_computing_id = await logged_in_or_raise(request, db_session)
115+
if computing_id != session_computing_id:
116+
await WebsiteAdmin.has_permission_or_raise(db_session, session_computing_id)
119117

120118
# all term info is public, so anyone can get any of it
121119
officer_terms = await officers.crud.get_officer_terms(

0 commit comments

Comments
 (0)