admin/roles: view, archive and restore

This commit is contained in:
Philippe Loctaux 2023-05-07 18:39:02 +02:00
parent 8fa2fb7ddc
commit d778380d8b
10 changed files with 363 additions and 2 deletions

View file

@ -41,4 +41,23 @@ impl Role {
Ok(())
}
pub async fn get_by_name(
conn: impl SqliteExecutor<'_>,
name: &RoleID,
) -> Result<Option<Self>, Error> {
Ok(DatabaseRoles::get_one_by_name(conn, name.as_ref())
.await?
.map(Self::from))
}
pub async fn set_archive_status(
&self,
conn: impl SqliteExecutor<'_>,
value: bool,
) -> Result<(), Error> {
DatabaseRoles::set_archive_status(conn, self.name.as_ref(), value).await?;
Ok(())
}
}