Make get_user_from_headers and check_is_moderator_from_headers take in a bitflag of Scopes rather than a slice of Scopes (#3765)

This commit is contained in:
Josiah Glosson
2025-06-09 14:29:32 -05:00
committed by GitHub
parent 06f1df1995
commit 3afb682fc6
28 changed files with 161 additions and 157 deletions

View File

@@ -60,7 +60,7 @@ pub async fn admin_user_email(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::SESSION_ACCESS]),
Scopes::SESSION_ACCESS,
)
.await
.map(|x| x.1)?;
@@ -114,7 +114,7 @@ pub async fn projects_list(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::PROJECT_READ]),
Scopes::PROJECT_READ,
)
.await
.map(|x| x.1)
@@ -150,7 +150,7 @@ pub async fn user_auth_get(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::USER_READ]),
Scopes::USER_READ,
)
.await?;
@@ -200,7 +200,7 @@ pub async fn user_get(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::SESSION_ACCESS]),
Scopes::SESSION_ACCESS,
)
.await
.map(|x| x.1)
@@ -231,7 +231,7 @@ pub async fn collections_list(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::COLLECTION_READ]),
Scopes::COLLECTION_READ,
)
.await
.map(|x| x.1)
@@ -279,7 +279,7 @@ pub async fn orgs_list(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::PROJECT_READ]),
Scopes::PROJECT_READ,
)
.await
.map(|x| x.1)
@@ -389,7 +389,7 @@ pub async fn user_edit(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::USER_WRITE]),
Scopes::USER_WRITE,
)
.await?;
@@ -561,7 +561,7 @@ pub async fn user_icon_edit(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::USER_WRITE]),
Scopes::USER_WRITE,
)
.await?
.1;
@@ -633,7 +633,7 @@ pub async fn user_icon_delete(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::USER_WRITE]),
Scopes::USER_WRITE,
)
.await?
.1;
@@ -685,7 +685,7 @@ pub async fn user_delete(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::USER_DELETE]),
Scopes::USER_DELETE,
)
.await?
.1;
@@ -726,7 +726,7 @@ pub async fn user_follows(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::USER_READ]),
Scopes::USER_READ,
)
.await?
.1;
@@ -768,7 +768,7 @@ pub async fn user_notifications(
&**pool,
&redis,
&session_queue,
Some(&[Scopes::NOTIFICATION_READ]),
Scopes::NOTIFICATION_READ,
)
.await?
.1;