pub async fn can_edit_by_id(&self, meeting_id: i64) -> Result<bool, TelescopeError> {
        // If the authenticated user is a coordinator or professor, then they can edit this meeting.
        if self.can_view_drafts() {
            Ok(true)
        } else {
            // Otherwise lookup the meeting and check if the authenticated user id matches the host
            // user id.
            let meeting_host: Option<uuid> = MeetingHost::get(meeting_id).await?;
            match (meeting_host, self.user_id) {
                // If there is both a host and a viewer, and they're the same,
                // the meeting can be edited.
                (Some(host), Some(viewer)) => Ok(host == viewer),

                // In any other case, the meeting is not to be edited by the viewer.
                _ => Ok(false),
            }
        }
    }
/// Can the user associated with this authorization edit the meeting
Can the user associated with this authorization edit the meeting
Can the user associated with this authorization edit the meeting
pub async fn can_edit_by_id(&self, meeting_id: i64) -> Result<bool, TelescopeError> {
        // If the authenticated user is a coordinator or professor, then they can edit this meeting.
        if self.can_view_drafts() {
            Ok(true)
        } else {
            // Otherwise lookup the meeting and check if the authenticated user id matches the host
            // user id.
            let meeting_host: Option<uuid> = MeetingHost::get(meeting_id).await?;
            match (meeting_host, self.user_id) {
                // If there is both a host and a viewer, and they're the same,
                // the meeting can be edited.
                (Some(host), Some(viewer)) => Ok(host == viewer),
                // In any other case, the meeting is not to be edited by the viewer.
                _ => Ok(false),
            }
        }
    }
pub async fn can_edit_by_id ( & self , meeting_id : i64 ) -> Result < bool , TelescopeError > { // If the authenticated user is a coordinator or professor, then they can edit this meeting. if self . can_view_drafts ( ) { Ok ( true ) } else { // Otherwise lookup the meeting and check if the authenticated user id matches the host // user id. let meeting_host : Option < uuid > = MeetingHost :: get ( meeting_id ) . await ? ; match ( meeting_host , self . user_id ) { // If there is both a host and a viewer, and they're the same, // the meeting can be edited. ( Some ( host ) , Some ( viewer ) ) => Ok ( host == viewer ) , // In any other case, the meeting is not to be edited by the viewer. _ => Ok ( false ) , } } }
Can the user associated with this authorization edit the meeting
Can the user associated with this authorization edit the meeting
&self
meeting_id
i64
&self
meeting_id
i64