move Permission into hive-types, drop swarm-controller's hive-sh4re dep
This commit is contained in:
parent
04786da58f
commit
e4a9005468
27 changed files with 221 additions and 175 deletions
|
|
@ -69,7 +69,6 @@ sha2.workspace = true
|
|||
similar.workspace = true
|
||||
# The `Permission` names `/api/agents/{name}/permissions` accepts, the same
|
||||
# enum the hive enforces.
|
||||
hive-sh4re.workspace = true
|
||||
# Validates `POST /api/agents`' `name` before it becomes `agent`/`repo`
|
||||
# everywhere downstream — see `create_agent`'s doc comment for why this is
|
||||
# defense-in-depth, not the only gate (per an argus review finding).
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use axum::extract::{Path, State};
|
|||
use axum::http::StatusCode;
|
||||
use backon::{ConstantBuilder, Retryable as _};
|
||||
use futures_util::StreamExt as _;
|
||||
use hive_sh4re::permissions::Permission;
|
||||
use hive_types::Permission;
|
||||
use problem_details::ProblemDetails;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use swarm_queue_client::agent_permissions::{self, AgentPermissions, Import, ImportReply};
|
||||
|
|
@ -528,7 +528,7 @@ mod tests {
|
|||
use crate::test_nats::TestNats;
|
||||
use axum::extract::{Path, State};
|
||||
use axum::http::StatusCode;
|
||||
use hive_sh4re::permissions::Permission;
|
||||
use hive_types::Permission;
|
||||
use swarm_queue_client::agent_permissions::{Import, ImportReply};
|
||||
|
||||
async fn published(client: &async_nats::Client, agent: &str) -> Option<String> {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use std::time::Duration;
|
|||
|
||||
use axum::Json;
|
||||
use axum::extract::State;
|
||||
use hive_sh4re::permissions::Permission;
|
||||
use hive_types::Permission;
|
||||
use problem_details::ProblemDetails;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use swarm_queue_client::archetypes::{ArchetypeMeta, BUILTIN_SOURCE, SourceRecord};
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ pub(crate) struct CreateAgentRequest {
|
|||
/// agent holds the default set.
|
||||
#[serde(default)]
|
||||
#[schema(value_type = Option<Vec<String>>)]
|
||||
pub(crate) permissions: Option<Vec<hive_sh4re::permissions::Permission>>,
|
||||
pub(crate) permissions: Option<Vec<hive_types::Permission>>,
|
||||
/// The archetype to build the agent from, one `GET /api/archetypes`
|
||||
/// lists. The agent then gets no `agent-configs/<name>` repo: its hive
|
||||
/// builds it from the archetype's module. Absent is a custom agent.
|
||||
|
|
@ -1513,10 +1513,8 @@ mod tests {
|
|||
.await
|
||||
.expect("a bucket that refuses any value");
|
||||
let state = crate::agent_limits::tests::state(&client);
|
||||
let earlier = crate::agent_permissions::at_create(vec![
|
||||
hive_sh4re::permissions::Permission::Messaging,
|
||||
])
|
||||
.expect("valid");
|
||||
let earlier = crate::agent_permissions::at_create(vec![hive_types::Permission::Messaging])
|
||||
.expect("valid");
|
||||
crate::agent_permissions::store(&client, "atlas", &earlier)
|
||||
.await
|
||||
.expect("an earlier grant");
|
||||
|
|
|
|||
Loading…
Reference in a new issue