Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(call): update required access level for calls (#2785)

Will Hutchinsona2dc2b27bf7f
diff --git a/rust/cloud-storage/call/src/domain/ports.rs b/rust/cloud-storage/call/src/domain/ports.rs
index 3cb0efdcc4..0a2117b143 100644
--- a/rust/cloud-storage/call/src/domain/ports.rs
+++ b/rust/cloud-storage/call/src/domain/ports.rs
@@ -5,7 +5,7 @@
use std::fmt::Debug;
use std::future::Future;
-use entity_access::domain::models::{EntityAccessReceipt, ViewAccessLevel};
+use entity_access::domain::models::{EditAccessLevel, EntityAccessReceipt, ViewAccessLevel};
use macro_user_id::user_id::MacroUserIdStr;
use uuid::Uuid;
@@ -333,13 +333,13 @@ pub trait CallService: Send + Sync + 'static {
/// table are untouched. Idempotent.
fn delete_call_record(
&self,
- receipt: EntityAccessReceipt<ViewAccessLevel>,
+ receipt: EntityAccessReceipt<EditAccessLevel>,
) -> impl Future<Output = Result<(), CallError>> + Send;
/// Edits a [`CallRecord`].
fn edit_call_record(
&self,
- receipt: EntityAccessReceipt<ViewAccessLevel>,
+ receipt: EntityAccessReceipt<EditAccessLevel>,
request: EditCallRecordRequest,
) -> impl Future<Output = Result<(), CallError>> + Send;
@@ -350,7 +350,7 @@ pub trait CallService: Send + Sync + 'static {
/// Returns the new value.
fn toggle_share_with_team(
&self,
- receipt: EntityAccessReceipt<ViewAccessLevel>,
+ receipt: EntityAccessReceipt<EditAccessLevel>,
) -> impl Future<Output = Result<bool, CallError>> + Send;
}
diff --git a/rust/cloud-storage/call/src/domain/service.rs b/rust/cloud-storage/call/src/domain/service.rs
index 80e82984b4..e777a6f4a0 100644
--- a/rust/cloud-storage/call/src/domain/service.rs
+++ b/rust/cloud-storage/call/src/domain/service.rs
@@ -4,7 +4,9 @@
mod test;
use connection::domain::ports::ConnectionService;
-use entity_access::domain::models::{EntityAccessReceipt, EntityType, ViewAccessLevel};
+use entity_access::domain::models::{
+ EditAccessLevel, EntityAccessReceipt, EntityType, ViewAccessLevel,
+};
use entity_access::domain::ports::EntityAccessService;
use macro_user_id::cowlike::CowLike;
use macro_user_id::user_id::MacroUserIdStr;
@@ -660,7 +662,7 @@ impl<
#[tracing::instrument(err, skip(self))]
async fn delete_call_record(
&self,
- receipt: EntityAccessReceipt<ViewAccessLevel>,
+ receipt: EntityAccessReceipt<EditAccessLevel>,
) -> Result<(), CallError> {
let entity = receipt.entity();
if entity.entity_type != EntityType::Call {
@@ -719,7 +721,7 @@ impl<
#[tracing::instrument(err, skip(self))]
async fn edit_call_record(
&self,
- receipt: EntityAccessReceipt<ViewAccessLevel>,
+ receipt: EntityAccessReceipt<EditAccessLevel>,
request: EditCallRecordRequest,
) -> Result<(), CallError> {
let entity = receipt.entity();
@@ -742,7 +744,7 @@ impl<
#[tracing::instrument(err, skip(self))]
async fn toggle_share_with_team(
&self,
- receipt: EntityAccessReceipt<ViewAccessLevel>,
+ receipt: EntityAccessReceipt<EditAccessLevel>,
) -> Result<bool, CallError> {
let entity = receipt.entity();
if entity.entity_type != EntityType::Call {
diff --git a/rust/cloud-storage/call/src/inbound/axum_router.rs b/rust/cloud-storage/call/src/inbound/axum_router.rs
index ded3c97fc2..c8f7c5b203 100644
--- a/rust/cloud-storage/call/src/inbound/axum_router.rs
+++ b/rust/cloud-storage/call/src/inbound/axum_router.rs
@@ -19,7 +19,7 @@ use axum::{
};
use entity_access::{
domain::{
- models::{MemberParticipantRole, ViewAccessLevel},
+ models::{EditAccessLevel, MemberParticipantRole, ViewAccessLevel},
ports::EntityAccessService,
},
inbound::axum_extractors::{
@@ -350,7 +350,7 @@ pub async fn get_call_record_handler<S: CallService, Svc: EntityAccessService>(
#[tracing::instrument(err, skip_all)]
pub async fn delete_call_record_handler<S: CallService, Svc: EntityAccessService>(
State(state): State<CallRouterState<S, Svc>>,
- access: CallAccessLevelExtractor<ViewAccessLevel, Svc>,
+ access: CallAccessLevelExtractor<EditAccessLevel, Svc>,
) -> Result<StatusCode, CallError> {
state
.service
@@ -381,7 +381,7 @@ pub async fn delete_call_record_handler<S: CallService, Svc: EntityAccessService
#[tracing::instrument(err, skip_all)]
pub async fn edit_call_record_handler<S: CallService, Svc: EntityAccessService>(
State(state): State<CallRouterState<S, Svc>>,
- access: CallAccessLevelExtractor<ViewAccessLevel, Svc>,
+ access: CallAccessLevelExtractor<EditAccessLevel, Svc>,
Json(request): Json<EditCallRecordRequest>,
) -> Result<StatusCode, CallError> {
state
@@ -412,7 +412,7 @@ pub async fn edit_call_record_handler<S: CallService, Svc: EntityAccessService>(
#[tracing::instrument(err, skip_all)]
pub async fn toggle_share_with_team_handler<S: CallService, Svc: EntityAccessService>(
State(state): State<CallRouterState<S, Svc>>,
- access: CallAccessLevelExtractor<ViewAccessLevel, Svc>,
+ access: CallAccessLevelExtractor<EditAccessLevel, Svc>,
) -> Result<Json<bool>, CallError> {
let new_value = state
.service
diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
index 1c77ea2c0b..ee779aefee 100644
--- a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs
@@ -96,7 +96,7 @@ impl CallRepository for PgCallRepo {
owner: created_by.to_string(),
channel_share_permissions: Some(vec![ChannelSharePermission {
channel_id: channel_id.to_string(),
- access_level: AccessLevel::View,
+ access_level: AccessLevel::Edit,
}]),
};
@@ -126,7 +126,7 @@ impl CallRepository for PgCallRepo {
"#,
&share_permission.id,
&channel_id.to_string(),
- share_permission.channel_share_permissions.as_ref().unwrap()[0].access_level as _,
+ AccessLevel::Edit as _,
)
.execute(tx.as_mut())
.await?;
@@ -148,7 +148,7 @@ impl CallRepository for PgCallRepo {
entity_access_db_utils::EntityType::Call,
&channel_id.to_string(),
entity_access_db_utils::EntityAccessSourceType::Channel,
- entity_access_db_utils::AccessLevel::View,
+ entity_access_db_utils::AccessLevel::Edit,
)
.await?;