test accountinfo

This commit is contained in:
weisd
2024-11-12 17:38:36 +08:00
parent 47ade0f135
commit b400860538
8 changed files with 102 additions and 26 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ use super::condition::{
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
pub struct ActionSet(HashSet<Action>);
pub struct ActionSet(pub HashSet<Action>);
impl ActionSet {
pub fn is_match(&self, act: &Action) -> bool {
+7 -1
View File
@@ -41,6 +41,12 @@ pub struct Resource {
}
impl Resource {
pub fn new(pattern: &str) -> Self {
Self {
pattern: pattern.to_owned(),
rtype: ResourceARNType::ResourceARNS3,
}
}
pub fn validate_bucket(&self, bucket: &str) -> Result<()> {
self.validate()?;
if !wildcard::match_pattern(&self.pattern, bucket)
@@ -187,7 +193,7 @@ impl<'de> Deserialize<'de> for Resource {
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
#[serde(transparent)]
pub struct ResourceSet(HashSet<Resource>);
pub struct ResourceSet(pub HashSet<Resource>);
impl ResourceSet {
pub fn validate_bucket(&self, bucket: &str) -> Result<()> {