cyfs_lib/acl/handler/
request.rs1use super::super::{AclAccess, AclAction};
2use crate::base::*;
3use crate::ndn::*;
4use crate::non::NONSlimObjectInfo;
5use cyfs_base::*;
6
7pub struct AclHandlerRequest {
8 pub protocol: RequestProtocol,
10
11 pub action: AclAction,
13
14 pub device_id: DeviceId,
16
17 pub object: Option<NONSlimObjectInfo>,
19 pub inner_path: Option<String>,
20
21 pub dec_id: String,
23
24 pub req_path: Option<String>,
26
27 pub referer_object: Option<Vec<NDNDataRefererObject>>,
29}
30
31impl std::fmt::Display for AclHandlerRequest {
32 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
33 write!(f, "protocol: {:?}", self.protocol)?;
34 write!(f, ", action: {:?}", self.action)?;
35 write!(f, ", device: {}", self.device_id)?;
36
37 if let Some(object) = &self.object {
38 write!(f, ", object: {:?}", object)?;
39 }
40
41 if let Some(inner_path) = &self.inner_path {
42 write!(f, ", inner_path: {}", inner_path)?;
43 }
44
45 write!(f, ", dec: {}", self.dec_id)?;
46 write!(f, ", req_path: {:?}", self.req_path)?;
47 if let Some(referer_object) = &self.referer_object {
48 write!(f, ", referer_object: {:?}", referer_object)?;
49 }
50
51 Ok(())
52 }
53}
54
55#[derive(Debug, Clone)]
56pub struct AclHandlerResponse {
57 pub access: AclAccess,
58}
59
60impl std::fmt::Display for AclHandlerResponse {
61 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
62 write!(f, "access: {:?}", self.access)
63 }
64}