Esempio n. 1
0
        private MeetingDTO GetMeeting(AdobeConnectProvider provider)
        {
            var meeting = this.CanvasCourseMeetingModel.GetOneByCourseId(Credentials.Id, Model.custom_canvas_course_id).Value;

            var canEdit = Model.roles != null &&
                          (Model.roles.Contains("Instructor") ||
                           Model.roles.Contains("Administrator"));

            if (meeting == null)
            {
                return
                    new MeetingDTO()
                    {
                        id             = "0",
                        connect_server = Credentials.ACDomain,
                        is_editable    = canEdit
                    }
            }
            ;

            var ret = this.GetMeetingDTOByScoId(meeting.ScoId, provider);

            if (ret.id == "0")
            {
                CanvasCourseMeetingModel.RegisterDelete(meeting);

                CanvasCourseMeetingModel.Flush();
            }
            else
            {
                var registeredUser = provider.GetAllByEmail(HttpUtility.UrlEncode(Model.lis_person_contact_email_primary));
                if (registeredUser.Values != null && registeredUser.Values.Any())
                {
                    var principalId = registeredUser.Values.First().PrincipalId;
                    IEnumerable <PermissionInfo> hosts        = provider.GetMeetingHosts(meeting.ScoId).Values,
                                                 participants = provider.GetMeetingParticipants(meeting.ScoId).Values,
                                                 presenters   = provider.GetMeetingPresenters(meeting.ScoId).Values;
                    if ((hosts != null && hosts.Any(h => h.PrincipalId == principalId)) ||
                        (participants != null && participants.Any(h => h.PrincipalId == principalId)) ||
                        (presenters != null && presenters.Any(h => h.PrincipalId == principalId)))
                    {
                        ret.can_join = true;
                    }
                }
            }

            ret.is_editable = canEdit;
            return(ret);
        }