server: Prevent regular users from modifying non-editable attributes

This commit is contained in:
Valentin Tolmer
2023-11-05 16:01:25 +01:00
committed by nitnelave
parent a6481dde56
commit 829c3f2bb1
2 changed files with 22 additions and 11 deletions

View File

@@ -160,10 +160,12 @@ pub struct AttributeList {
}
impl AttributeList {
pub fn get_attribute_schema(&self, name: &str) -> Option<&AttributeSchema> {
self.attributes.iter().find(|a| a.name == name)
}
pub fn get_attribute_type(&self, name: &str) -> Option<(AttributeType, bool)> {
self.attributes
.iter()
.find(|a| a.name == name)
self.get_attribute_schema(name)
.map(|a| (a.attribute_type, a.is_list))
}
}