class SCHEMA_CLS(BaseSignedDataSchema): type = fields.EnumCheckedConstant(ManifestType.WORKSPACE_MANIFEST, required=True) id = EntryIDField(required=True) # Version 0 means the data is not synchronized version = fields.Integer(required=True, validate=validate.Range(min=0)) created = fields.DateTime(required=True) updated = fields.DateTime(required=True) children = fields.FrozenMap( EntryNameField(validate=validate.Length(min=1, max=256)), EntryIDField(required=True), required=True, ) @pre_load def fix_legacy(self, data: Dict[str, T]) -> Dict[str, T]: # Compatibility with versions <= 1.14 if data["author"] is None: data["author"] = LOCAL_AUTHOR_LEGACY_PLACEHOLDER return data @post_load def make_obj(self, data: Dict[str, Any]) -> "WorkspaceManifest": data.pop("type") return WorkspaceManifest(**data)
class SCHEMA_CLS(BaseSchema): name = EntryNameField(required=True) id = EntryIDField(required=True) key = fields.SecretKey(required=True) encryption_revision = fields.Int(required=True, validate=validate.Range(min=0)) encrypted_on = fields.DateTime(required=True) role_cached_on = fields.DateTime(required=True) role = RealmRoleField(required=True, allow_none=True) @post_load def make_obj(self, data: Dict[str, Any]) -> "WorkspaceEntry": return WorkspaceEntry(**data)
class SCHEMA_CLS(BaseSignedDataSchema): type = fields.CheckedConstant("workspace_manifest", required=True) id = EntryIDField(required=True) # Version 0 means the data is not synchronized (hence author sould be None) version = fields.Integer(required=True, validate=validate.Range(min=0)) created = fields.DateTime(required=True) updated = fields.DateTime(required=True) children = fields.FrozenMap( EntryNameField(validate=validate.Length(min=1, max=256)), EntryIDField(required=True), required=True, ) @post_load def make_obj(self, data): data.pop("type") return WorkspaceManifest(**data)
class SCHEMA_CLS(BaseSignedDataSchema): type = fields.EnumCheckedConstant(MessageContentType.SHARING_GRANTED, required=True) name = EntryNameField(required=True) id = EntryIDField(required=True) encryption_revision = fields.Integer(required=True) encrypted_on = fields.DateTime(required=True) key = fields.SecretKey(required=True) # Don't include role given the only reliable way to get this information # is to fetch the realm role certificate from the backend. # Besides, we will also need the message sender's realm role certificate # to make sure he is an owner. @post_load def make_obj( # type: ignore[misc] self, data: Dict[str, Any]) -> "SharingGrantedMessageContent": data.pop("type") return SharingGrantedMessageContent(**data)