api/permissions: support test-harness
(Api-macro tests want to use `==` to compare generated schemas against hardcoded schemas.) Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
5aeebdab44
commit
b67e2f7214
@ -6,6 +6,7 @@ use std::fmt;
|
||||
use serde_json::Value;
|
||||
|
||||
/// Access permission
|
||||
#[cfg_attr(feature = "test-harness", derive(Eq, PartialEq))]
|
||||
pub enum Permission {
|
||||
/// Allow Superuser
|
||||
Superuser,
|
||||
@ -70,6 +71,7 @@ impl fmt::Debug for Permission {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait to query user information (used by check_api_permission)
|
||||
pub trait UserInformation {
|
||||
fn is_superuser(&self, userid: &str) -> bool;
|
||||
|
@ -386,6 +386,7 @@ fn dummy_handler_fn(
|
||||
const DUMMY_HANDLER: ApiHandler = ApiHandler::Sync(&dummy_handler_fn);
|
||||
|
||||
/// Access permission with description
|
||||
#[cfg_attr(feature = "test-harness", derive(Eq, PartialEq))]
|
||||
pub struct ApiAccessPermissions {
|
||||
pub description: &'static str,
|
||||
pub permission: &'static Permission,
|
||||
|
Loading…
x
Reference in New Issue
Block a user