| 140 | } |
| 141 | |
| 142 | async fn get_capabilities( |
| 143 | &self, |
| 144 | _request: Request<GetCapabilitiesRequest>, |
| 145 | ) -> Result<Response<GetCapabilitiesResponse>, Status> { |
| 146 | let methods = METHOD_MATRIX |
| 147 | .iter() |
| 148 | .map(|(service, method)| { |
| 149 | if *service == "MaintenanceService" && *method == "CompactDatabase" { |
| 150 | MethodDescriptorInfo { |
| 151 | service: service.to_string(), |
| 152 | method: method.to_string(), |
| 153 | scope: ExecutionScope::Local as i32, |
| 154 | required_capabilities: vec!["maintenance.admin".to_string()], |
| 155 | allowed_callers: vec![CallerClass::Local as i32], |
| 156 | effects: vec![RpcEffect::RepositoryWrite as i32], |
| 157 | } |
| 158 | } else if *service == "VaultService" && *method == "ReplayVaultEvidence" { |
| 159 | MethodDescriptorInfo { |
| 160 | service: service.to_string(), |
| 161 | method: method.to_string(), |
| 162 | scope: ExecutionScope::Both as i32, |
| 163 | required_capabilities: vec!["vault.read".to_string()], |
| 164 | allowed_callers: vec![CallerClass::Local as i32], |
| 165 | effects: vec![RpcEffect::RepositoryRead as i32], |
| 166 | } |
| 167 | } else if *service == "KnowledgeService" |
| 168 | && matches!(*method, "GetProjectIdentity" | "GetWorkflowSnapshot") |
| 169 | { |
| 170 | MethodDescriptorInfo { |
| 171 | service: service.to_string(), |
| 172 | method: method.to_string(), |
| 173 | scope: ExecutionScope::Local as i32, |
| 174 | required_capabilities: vec![if *method == "GetProjectIdentity" { |
| 175 | "repository.read" |
| 176 | } else { |
| 177 | "knowledge.read" |
| 178 | } |
| 179 | .to_owned()], |
| 180 | allowed_callers: vec![CallerClass::Local as i32], |
| 181 | effects: vec![RpcEffect::RepositoryRead as i32], |
| 182 | } |
| 183 | } else if *service == "ProvenanceService" |
| 184 | && matches!(*method, "AppendHookLog" | "LoadHookLog") |
| 185 | { |
| 186 | let write = *method == "AppendHookLog"; |
| 187 | MethodDescriptorInfo { |
| 188 | service: service.to_string(), |
| 189 | method: method.to_string(), |
| 190 | scope: ExecutionScope::Local as i32, |
| 191 | required_capabilities: vec![if write { |
| 192 | "provenance.write" |
| 193 | } else { |
| 194 | "provenance.read" |
| 195 | } |
| 196 | .to_string()], |
| 197 | allowed_callers: vec![CallerClass::Local as i32], |
| 198 | effects: vec![if write { |
| 199 | RpcEffect::RepositoryWrite |