make superadmin_secret work also for apis

This commit is contained in:
Ruben Fiszel
2023-03-24 14:53:28 +01:00
parent 70a7089352
commit 45c52f7723
+7 -1
View File
@@ -7,12 +7,18 @@
*/
use sqlx::{Postgres, Transaction};
use windmill_common::error::{self, Error};
use windmill_common::{
error::{self, Error},
users::SUPERADMIN_SECRET_EMAIL,
};
pub async fn require_super_admin<'c>(
db: &mut Transaction<'c, Postgres>,
email: &str,
) -> error::Result<()> {
if email == SUPERADMIN_SECRET_EMAIL {
return Ok(());
}
let is_admin = sqlx::query_scalar!("SELECT super_admin FROM password WHERE email = $1", email)
.fetch_one(db)
.await