server: Add a is_readonly attribute to the schema
This commit is contained in:
committed by
nitnelave
parent
3ec44a58be
commit
b1384818d2
@@ -147,6 +147,7 @@ pub struct AttributeSchema {
|
||||
pub is_visible: bool,
|
||||
pub is_editable: bool,
|
||||
pub is_hardcoded: bool,
|
||||
pub is_readonly: bool,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)]
|
||||
|
||||
@@ -50,6 +50,7 @@ impl From<Model> for AttributeSchema {
|
||||
is_visible: value.is_group_visible,
|
||||
is_editable: value.is_group_editable,
|
||||
is_hardcoded: value.is_hardcoded,
|
||||
is_readonly: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ impl From<Model> for AttributeSchema {
|
||||
is_visible: value.is_user_visible,
|
||||
is_editable: value.is_user_editable,
|
||||
is_hardcoded: value.is_hardcoded,
|
||||
is_readonly: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: false,
|
||||
is_hardcoded: true,
|
||||
is_readonly: true,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "creation_date".into(),
|
||||
@@ -51,6 +52,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: false,
|
||||
is_hardcoded: true,
|
||||
is_readonly: true,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "mail".into(),
|
||||
@@ -59,6 +61,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: true,
|
||||
is_hardcoded: true,
|
||||
is_readonly: false,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "uuid".into(),
|
||||
@@ -67,6 +70,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: false,
|
||||
is_hardcoded: true,
|
||||
is_readonly: true,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "display_name".into(),
|
||||
@@ -75,6 +79,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: true,
|
||||
is_hardcoded: true,
|
||||
is_readonly: false,
|
||||
},
|
||||
]);
|
||||
schema
|
||||
@@ -89,6 +94,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: false,
|
||||
is_hardcoded: true,
|
||||
is_readonly: true,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "creation_date".into(),
|
||||
@@ -97,6 +103,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: false,
|
||||
is_hardcoded: true,
|
||||
is_readonly: true,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "uuid".into(),
|
||||
@@ -105,6 +112,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: false,
|
||||
is_hardcoded: true,
|
||||
is_readonly: true,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "display_name".into(),
|
||||
@@ -113,6 +121,7 @@ impl From<Schema> for PublicSchema {
|
||||
is_visible: true,
|
||||
is_editable: true,
|
||||
is_hardcoded: true,
|
||||
is_readonly: false,
|
||||
},
|
||||
]);
|
||||
schema
|
||||
|
||||
@@ -196,6 +196,7 @@ mod tests {
|
||||
is_visible: true,
|
||||
is_editable: true,
|
||||
is_hardcoded: true,
|
||||
is_readonly: false,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "first_name".into(),
|
||||
@@ -204,6 +205,7 @@ mod tests {
|
||||
is_visible: true,
|
||||
is_editable: true,
|
||||
is_hardcoded: true,
|
||||
is_readonly: false,
|
||||
},
|
||||
AttributeSchema {
|
||||
name: "last_name".into(),
|
||||
@@ -212,6 +214,7 @@ mod tests {
|
||||
is_visible: true,
|
||||
is_editable: true,
|
||||
is_hardcoded: true,
|
||||
is_readonly: false,
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -246,6 +249,7 @@ mod tests {
|
||||
is_visible: false,
|
||||
is_editable: false,
|
||||
is_hardcoded: false,
|
||||
is_readonly: false,
|
||||
};
|
||||
assert!(fixture
|
||||
.handler
|
||||
@@ -329,6 +333,7 @@ mod tests {
|
||||
is_visible: true,
|
||||
is_editable: false,
|
||||
is_hardcoded: false,
|
||||
is_readonly: false,
|
||||
};
|
||||
assert!(fixture
|
||||
.handler
|
||||
|
||||
Reference in New Issue
Block a user