mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
test accountinfo
This commit is contained in:
@@ -2,6 +2,7 @@ use crate::error::{Error, Result};
|
|||||||
// use rmp_serde::Serializer as rmpSerializer;
|
// use rmp_serde::Serializer as rmpSerializer;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
action::{Action, ActionSet, IAMActionConditionKeyMap},
|
action::{Action, ActionSet, IAMActionConditionKeyMap},
|
||||||
@@ -35,11 +36,11 @@ pub struct BPStatement {
|
|||||||
pub principal: Principal,
|
pub principal: Principal,
|
||||||
#[serde(rename = "Action")]
|
#[serde(rename = "Action")]
|
||||||
pub actions: ActionSet,
|
pub actions: ActionSet,
|
||||||
#[serde(rename = "NotAction", default)]
|
#[serde(rename = "NotAction", skip_serializing_if = "ActionSet::is_empty")]
|
||||||
pub not_actions: ActionSet,
|
pub not_actions: ActionSet,
|
||||||
#[serde(rename = "Resource")]
|
#[serde(rename = "Resource", skip_serializing_if = "ResourceSet::is_empty")]
|
||||||
pub resources: ResourceSet,
|
pub resources: ResourceSet,
|
||||||
#[serde(rename = "Condition", default)]
|
#[serde(rename = "Condition", skip_serializing_if = "Functions::is_empty")]
|
||||||
pub conditions: Functions,
|
pub conditions: Functions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ impl Functions {
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
}
|
}
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.0.is_empty()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for Functions {
|
impl Debug for Functions {
|
||||||
|
|||||||
@@ -228,6 +228,10 @@ impl ResourceSet {
|
|||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.0.is_empty()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AsRef<HashSet<Resource>> for ResourceSet {
|
impl AsRef<HashSet<Resource>> for ResourceSet {
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ impl Operation for AccountInfoHandler {
|
|||||||
statements: vec![BPStatement {
|
statements: vec![BPStatement {
|
||||||
sid: "".to_owned(),
|
sid: "".to_owned(),
|
||||||
effect: Effect::Allow,
|
effect: Effect::Allow,
|
||||||
actions: ActionSet(s3_all_act),
|
actions: ActionSet(s3_all_act.clone()),
|
||||||
resources: ResourceSet(all_res),
|
resources: ResourceSet(all_res),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}],
|
}],
|
||||||
|
|||||||
Reference in New Issue
Block a user