From c3cc8a2bd52c572be067d99b984427d9bcdb3116 Mon Sep 17 00:00:00 2001 From: George Kaklamanos Date: Mon, 20 Nov 2023 20:52:22 +0200 Subject: [PATCH] acl: Add PartialEq for the structs --- labadoor-acl/src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/labadoor-acl/src/lib.rs b/labadoor-acl/src/lib.rs index 779785a..36af390 100644 --- a/labadoor-acl/src/lib.rs +++ b/labadoor-acl/src/lib.rs @@ -1,6 +1,6 @@ use serde_derive::Deserialize; -#[derive(Deserialize, Debug)] +#[derive(Deserialize, PartialEq, Debug)] pub struct ACLEntry { pub username: String, pub resource: String, @@ -20,6 +20,20 @@ pub struct ResourceShortcuts { pub id: i8, } +impl PartialEq for AuthMethod { + fn eq(&self, other: &Self) -> bool{ + (self.method == other.method) + && (self.identifier == other.identifier) + } +} + +impl PartialEq for ResourceShortcuts { + fn eq(&self, other: &Self) -> bool{ + (self.username == other.username) + && (self.id == other.id) + } +} + pub trait ACL { /// `Option`s on delete operations mean that all associated data is removed /// ACLEntry