Exemplo n.º 1
0
        private void SetDefaultUsers(List <UserDTO> users, AdobeConnectProvider provider, string meetingScoId)
        {
            foreach (var ugroup in users.GroupBy(u => u.id))
            {
                var u = ugroup.First();

                if (u.login_id == null && u.email == null)
                {
                    continue;
                }

                var acUser = provider.GetAllByEmail(HttpUtility.UrlEncode(u.login_id ?? u.email));
                if (acUser.Values.Count() == 0)
                {
                    var res = provider.PrincipalUpdate(
                        new PrincipalSetup()
                    {
                        Email     = u.login_id ?? u.email,
                        FirstName = u.name,
                        LastName  = u.name,
                        Password  = System.Web.Security.Membership.GeneratePassword(8, 2),
                        Login     = u.login_id ?? u.email
                    });
                    acUser = provider.GetAllByEmail(HttpUtility.UrlEncode(u.login_id ?? u.email));
                }

                var permission = MeetingPermissionId.view;
                var roles      = ugroup.Where(ug => ug.canvas_role != null).Select(ug => ug.canvas_role.ToLower()).ToList();

                if (roles.Contains("teacher"))
                {
                    permission = MeetingPermissionId.host;
                }
                else if (roles.Contains("ta") || roles.Contains("designer"))
                {
                    permission = MeetingPermissionId.mini_host;
                }

                if (acUser.Values != null)
                {
                    foreach (var val in acUser.Values)
                    {
                        var res = provider.UpdateScoPermissionForPrincipal(
                            meetingScoId,
                            val.PrincipalId,
                            permission);
                    }
                }
            }
        }
Exemplo n.º 2
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);
        }