Skip to content

Commit b5cc7db

Browse files
committed
Add remaining missing fields in Ability
1 parent 6310c25 commit b5cc7db

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

crates/intercode_signups/src/partial_objects/ability_signups_fields.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,49 @@ impl AbilitySignupsFields {
160160
)
161161
.await
162162
}
163+
164+
#[graphql(name = "can_update_signup")]
165+
async fn can_update_signup(&self, ctx: &Context<'_>, signup_id: ID) -> Result<bool, Error> {
166+
let policy_model = self.get_signup_policy_model(ctx, signup_id).await?;
167+
168+
model_action_permitted(
169+
self.authorization_info.as_ref(),
170+
SignupPolicy,
171+
ctx,
172+
&SignupAction::Manage,
173+
|_ctx| Ok(Some(&policy_model)),
174+
)
175+
.await
176+
}
177+
178+
#[graphql(name = "can_update_signups")]
179+
async fn can_update_signups(&self, ctx: &Context<'_>) -> Result<bool, Error> {
180+
let query_data = ctx.data::<QueryData>()?;
181+
let Some(convention) = query_data.convention() else {
182+
return Ok(false);
183+
};
184+
185+
let policy_model = (
186+
convention.clone(),
187+
events::Model {
188+
convention_id: convention.id,
189+
..Default::default()
190+
},
191+
runs::Model {
192+
..Default::default()
193+
},
194+
signups::Model {
195+
..Default::default()
196+
},
197+
);
198+
199+
model_action_permitted(
200+
self.authorization_info.as_ref(),
201+
SignupPolicy,
202+
ctx,
203+
&SignupAction::Manage,
204+
|_ctx| Ok(Some(&policy_model)),
205+
)
206+
.await
207+
}
163208
}

0 commit comments

Comments
 (0)