Esempio n. 1
0
        //public static IUserGroupPermissionProvider DefaultUserGroupPermissionProvider()
        //{
        //    return new DefaultUserGroupPermissionProvider();
        //}

        public override Task <AdobeConnectUser> FindAsync(string userName, string password)
        {
            Task <AdobeConnectUser> taskInvoke = Task.Run(async() =>
            {
                string[] parts      = userName.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                string companyToken = parts[0];
                string acDomain     = parts[1];
                string acLogin      = parts[2];

                if (!_acDomainValidator.IsValid(companyToken, acDomain))
                {
                    _logger?.Warn($"[UserManager.FindAsync] AC domain is not valid for companyToken. AcDomain={acDomain}");
                    return(null);
                }

                string sessionToken;
                var connectionDetails = new ConnectionDetails(new Uri(acDomain));
                var provider          = new AdobeConnectProvider(connectionDetails);
                UserInfo acPrincipal  = TryLogin(provider, new AdobeConnectAccess(new Uri(acDomain), acLogin, password), out sessionToken);
                _logger?.Info($"[UserManager.FindAsync] ACSession={sessionToken}");

                if (acPrincipal == null)
                {
                    _logger?.Warn($"[UserManager.FindAsync] Principal not found. AcDomain={acDomain}, AcLogin={acLogin}");
                    return(null);
                }

                var roles = new List <string>();
                if (_userAuthorizationProvider != null)
                {
                    roles.AddRange(_userAuthorizationProvider.GetUserPermissions(provider, acPrincipal));
                }

                var applicationUser = new AdobeConnectUser
                {
                    Id       = acPrincipal.UserId,
                    UserName = acLogin,

                    CompanyToken   = companyToken,
                    AcDomain       = acDomain,
                    AcSessionToken = sessionToken,
                    Roles          = roles
                };
                var store = Store as IEdugameCloudUserStore <AdobeConnectUser>;
                if (store != null)
                {
                    var user = await store.FindByPrincipalIdAndCompanyTokenAndAcDomainAsync(applicationUser.Id, companyToken,
                                                                                            acDomain);
                    if (user == null)
                    {
                        _logger?.Warn($"[UserManager.FindAsync] UserStore.CreateAsync. PrincipalId={applicationUser.Id}");
                        await store.CreateAsync(applicationUser, password);
                    }
                }

                return(applicationUser);
            });

            return(taskInvoke);
        }
Esempio n. 2
0
        public override bool UserHasGroupPermission(AdobeConnectProvider provider, UserInfo user)
        {
            if (UserIsSpecialACGroupParticipant(provider, user, PrincipalType.admins))
            {
                return(true);
            }

            if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["MonitoringGroups"]))
            {
                return(false);
            }

            string[] configGroups = ConfigurationManager.AppSettings["MonitoringGroups"].Split(',', ';');
            var      groups       = provider.GetGroupsByType(PrincipalType.group);

            if (groups?.Values != null)
            {
                var filteredGroups = groups.Values.Where(x => configGroups.Any(tg => tg.Trim() == x.Name));
                foreach (var groupPrincipal in filteredGroups)
                {
                    if (UserIsGroupParticipant(provider, user, groupPrincipal))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 3
0
        public void SetupCustomField()
        {
            AdobeConnectProvider provider = GetProvider();
            var field = provider.GetCustomField("esync-mp4-result").Value;

            string recordingId = "44636"; //  User Meetings >  [email protected] >  isa test mp4 >  recUNO
            // User Content > [email protected] > MP4 Recordings > isa test mp4 > recUNO
            var info = new
            {
                mp4 = "85704",
                vtt = "85705",
            };
            string     fieldValue  = Newtonsoft.Json.JsonConvert.SerializeObject(info);
            StatusInfo setupResult = provider.UpdateAclField(new List <AclFieldUpdateTrio>
            {
                new AclFieldUpdateTrio
                {
                    AclId   = recordingId,
                    FieldId = field.FieldId,
                    Value   = fieldValue,
                },
            });

            FieldResult originalName = provider.GetAclField(recordingId, field.FieldId);
        }
Esempio n. 4
0
        public void WillGetAccountDetails()
        {
            //var login = "******";
            //var password = "******";
            // !! User should be an admin!
            var login             = "******";
            var password          = "******";
            var apiUrl            = new Uri("https://fiustg.adobeconnect.com");
            var connectionDetails = new ConnectionDetails(apiUrl);
            var provider          = new AdobeConnectProvider(connectionDetails);

            var         userCredentials = new UserCredentials(login, password, "965886535");
            LoginResult loginResult     = provider.Login(userCredentials);

            if (!loginResult.Success)
            {
                throw new InvalidOperationException("Invalid login");
            }

            var fakeLogger  = new FakeLogger();
            var service     = new AdobeConnectAccountService(fakeLogger);
            var principalId = loginResult.User.UserId;
            var proxy       = new AdobeConnectProxy(provider, fakeLogger, apiUrl, principalId);
            var details     = service.GetAccountDetails(proxy);
            var t           = 1;
        }
Esempio n. 5
0
        public override bool UserHasGroupPermission(AdobeConnectProvider provider, UserInfo user)
        {
            if (UserIsSpecialACGroupParticipant(provider, user, PrincipalType.admins))
            {
                return(true);
            }

            if (!_configGroups.Any())
            {
                return(false);
            }

            var groups = provider.GetGroupsByType(PrincipalType.group);

            if (groups?.Values != null)
            {
                var filteredGroups = groups.Values.Where(x => _configGroups.Any(tg => tg.Trim() == x.Name));
                foreach (var groupPrincipal in filteredGroups)
                {
                    if (UserIsGroupParticipant(provider, user, groupPrincipal))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 6
0
        private CompanyEventDTO[] GetAllEventsFromAcServer(CompanyAcServer defaultAcDomain, bool isShowPastEvents = false, bool publishedOnly = false)
        {
            var acUri       = new Uri(defaultAcDomain.AcServer);
            var acProvider  = new AdobeConnectProvider(new ConnectionDetails(acUri));
            var acProxy     = new AdobeConnectProxy(acProvider, Logger, acUri);
            var loginResult = acProxy.Login(new UserCredentials(defaultAcDomain.Username, defaultAcDomain.Password));

            if (!loginResult.Success)
            {
                return(null);
            }

            var eventType    = acProxy.GetShortcutByType("events");
            var eventContent = acProxy.GetScoExpandedContent(eventType.ScoId);

            if (!eventContent.Success)
            {
                return(null);
            }

            var result     = new List <CompanyEventDTO>();
            var eventsOnly = eventContent.Values.Where(x => x.Type == "event");

            if (!isShowPastEvents)
            {
                eventsOnly = eventsOnly.Where(x => x.EndDateLocal >= DateTime.Now);
            }

            if (publishedOnly)
            {
                var publishedEvents = acProxy.GetEventList();
                if (!publishedEvents.Success)
                {
                    return(null); // TODO: may be write error message to log at least?
                }
                eventsOnly = eventsOnly.Where(x => publishedEvents.Values.Any(e => e.ScoId == x.ScoId));
            }

            foreach (var content in eventsOnly)
            {
                result.Add(new CompanyEventDTO
                {
                    companyId         = defaultAcDomain.Company.Id,
                    dateBegin         = DateTime.SpecifyKind(content.BeginDate, DateTimeKind.Utc),
                    dateEnd           = DateTime.SpecifyKind(content.EndDate, DateTimeKind.Utc),
                    name              = content.Name,
                    desc              = content.Description,
                    scoId             = content.ScoId,
                    urlPath           = content.UrlPath,
                    dateCreated       = DateTime.SpecifyKind(content.DateCreated, DateTimeKind.Utc),
                    dateModified      = DateTime.SpecifyKind(content.DateModified, DateTimeKind.Utc),
                    isSeminar         = content.IsSeminar,
                    isMappedToQuizzes = CompanyEventQuizMappingModel.GetAllByCompanyId(defaultAcDomain.Company.Id).Any(x => x.AcEventScoId == content.ScoId),
                    meetingUrl        = acProxy.GetScoInfo(content.ScoId).ScoInfo?.SourceSco?.UrlPath,
                });
            }

            return(result.ToArray());
        }
Esempio n. 7
0
        public OperationResultDto IsEventValid(CompanyQuizEventMappingSaveDTO eventQuizMapping)
        {
            var defaultAcDomain = CompanyAcServerModel.GetOneById(eventQuizMapping.companyAcDomainId).Value;

            if (defaultAcDomain == null)
            {
                return(OperationResultDto.Error("Company was not found"));
            }

            var acUri       = new Uri(defaultAcDomain.AcServer);
            var acProvider  = new AdobeConnectProvider(new ConnectionDetails(acUri));
            var acProxy     = new AdobeConnectProxy(acProvider, Logger, acUri);
            var loginResult = acProxy.Login(new UserCredentials(defaultAcDomain.Username, defaultAcDomain.Password));

            if (!loginResult.Success)
            {
                return(null);
            }

            var eventRegistrationDetails = acProxy.GetEventRegistrationDetails(eventQuizMapping.acEventScoId);

            string[] requiredFieldNames = new string[3] {
                "School", "State", "Trainee number or ID"
            };
            StringBuilder errorMessage = new StringBuilder();

            foreach (var fieldName in requiredFieldNames)
            {
                if (!eventRegistrationDetails.EventFields.Any(ef =>
                                                              string.Equals(ef.Description, fieldName, StringComparison.OrdinalIgnoreCase)))
                {
                    errorMessage.Append($"{fieldName} field is missed.{Environment.NewLine}");
                }
            }

            var eventInfo = acProxy.GetEventInfo(eventQuizMapping.acEventScoId);

            if (string.IsNullOrEmpty(eventInfo.EventInfo.Info))
            {
                errorMessage.Append(
                    $"Event info should be set for the event with sco-id {eventQuizMapping.acEventScoId}.{Environment.NewLine}");
            }

            if (string.IsNullOrEmpty(eventInfo.EventInfo.SpeakerName))
            {
                errorMessage.Append(
                    $"Speaker name should be set for the event with sco-id {eventQuizMapping.acEventScoId}.{Environment.NewLine}");
            }

            if (!string.IsNullOrEmpty(errorMessage.ToString()))
            {
                errorMessage.Append(
                    $"Please fix the event details in Adobe Connect and try again.{Environment.NewLine}");
            }

            return(string.IsNullOrEmpty(errorMessage.ToString())
                ? OperationResultDto.Success()
                : OperationResultDto.Error(errorMessage.ToString()));
        }
Esempio n. 8
0
        public void WillUpdateMeetingHTMLLaunch()
        {
            var email      = "";
            var acApiUrl   = new Uri("https://esynctraining.adobeconnect.com");
            var con        = new ConnectionDetails(acApiUrl);
            var acProvider = new AdobeConnectProvider(con);
            var proxy      = new AdobeConnectProxy(acProvider, new FakeLogger(), acApiUrl, String.Empty);

            proxy.Login(new UserCredentials("", ""));//admin
            var update = proxy.UpdateAclField("1690082137", AclFieldId.meetingHTMLLaunch.ToString(), false.ToString().ToLower());
        }
Esempio n. 9
0
        protected bool UserIsSpecialACGroupParticipant(AdobeConnectProvider provider, UserInfo user, PrincipalType groupType)
        {
            var group = provider.GetGroupsByType(groupType);

            if (group.Status.Code != StatusCodes.ok)
            {
                return(false);
            }

            return(UserIsGroupParticipant(provider, user, group.Values.First()));
        }
Esempio n. 10
0
        public void TestNewEventFieldsInScoInfo()
        {
            var acApiUrl   = new Uri("https://connect.esynctraining.com");
            var con        = new ConnectionDetails(acApiUrl);
            var acProvider = new AdobeConnectProvider(con);
            var proxy      = new AdobeConnectProxy(acProvider, new FakeLogger(), acApiUrl);

            proxy.Login(new UserCredentials("*****@*****.**", "Nastya123"));
            var eventInfo = proxy.GetScoInfo("2957329");

            Assert.Equals(eventInfo.ScoInfo.EventTemplateScoId, 56489);
        }
Esempio n. 11
0
        public void WillReportUserTrainingsTaken()
        {
            var principalId = "1004370065";
            var acApiUrl    = new Uri("http://rhi.adobeconnect.com");
            var con         = new ConnectionDetails(acApiUrl);
            var acProvider  = new AdobeConnectProvider(con);
            var proxy       = new AdobeConnectProxy(acProvider, new FakeLogger(), acApiUrl, String.Empty);

            //proxy.report
            proxy.Login(new UserCredentials("*****@*****.**", "e$ync123RHI"));//admin
            var result = proxy.ReportUserTrainingsTaken(principalId);
        }
Esempio n. 12
0
        public void WillGetEventInfo()
        {
            var acApiUrl   = new Uri("http://connect.esynctraining.com");
            var con        = new ConnectionDetails(acApiUrl);
            var acProvider = new AdobeConnectProvider(con);
            var proxy      = new AdobeConnectProxy(acProvider, new FakeLogger(), acApiUrl, String.Empty);

            //proxy.report
            proxy.Login(new UserCredentials("*****@*****.**", "tratata"));//admin
            var eventInfo = proxy.GetScoInfo("2957329");

            Assert.Equals(eventInfo.ScoInfo.EventTemplateScoId, 56489);
        }
Esempio n. 13
0
 public static async Task WillCreateEvent()
 {
     var acApiUrl        = "https://connectstage.esynctraining.com/";
     var con             = new ConnectionDetails(new Uri(acApiUrl));
     var acProvider      = new AdobeConnectProvider(con);
     var login           = "******";
     var password        = "******";
     var eventName       = $"__newMyTest{DateTime.Now:yyyy-M-d hh-mm-ss}";
     var eventStartDate  = DateTime.Now;
     var eventEndDate    = eventStartDate.AddDays(1);
     var saveEventFields = new SaveEventFields(new UserCredentials(login, password), eventName, eventStartDate, eventEndDate);
     var result          = await acProvider.CreateEvent(saveEventFields);
 }
Esempio n. 14
0
        public IAdobeConnectProxy GetProvider2(IAdobeConnectAccess2 credentials, bool checkSessionIsAlive = true)
        {
            if (checkSessionIsAlive)
            {
                return(GetProvider2(credentials));
            }

            var connectionDetails = new ConnectionDetails(credentials.Domain);
            var provider          = new AdobeConnectProvider(connectionDetails);

            provider.SetSessionId(credentials.SessionToken);
            return(new AdobeConnectProxy(provider, _logger, credentials.Domain));
        }
Esempio n. 15
0
        private AdobeConnectProvider GetProvider()
        {
            string apiUrl    = "http://connectdev.esynctraining.com/api/xml";
            string login     = "******";
            string pwd       = "e$ync123";
            string accountId = null;

            var connectionDetails = new ConnectionDetails(apiUrl);
            var provider          = new AdobeConnectProvider(connectionDetails);
            var loginResult       = provider.Login(new UserCredentials(login, pwd, accountId));

            return(provider);
        }
Esempio n. 16
0
        public IAdobeConnectProxy GetProvider2(IAdobeConnectAccess2 credentials)
        {
            var         connectionDetails = new ConnectionDetails(credentials.Domain);
            var         provider          = new AdobeConnectProvider(connectionDetails);
            LoginResult result            = provider.LoginWithSessionId(credentials.SessionToken);

            if (!result.Success || (result.User == null))
            {
                _logger.Error("AdobeConnectAccountService.GetProvider. Login failed. Status = " + result.Status.GetErrorInfo());
                throw new InvalidOperationException("Login to Adobe Connect failed. Status = " + result.Status.GetErrorInfo());
            }

            return(new AdobeConnectProxy(provider, _logger, credentials.Domain));
        }
Esempio n. 17
0
        public void WillGetUserTrainingsTaken()
        {
            var principalId = "1004370065";
            var acApiUrl    = "http://rhi.adobeconnect.com/";
            var con         = new ConnectionDetails(new Uri(acApiUrl));
            var acProvider  = new AdobeConnectProvider(con);
            var loginResult = acProvider.Login(new UserCredentials("*****@*****.**", "e$ync123RHI"));

            if (!loginResult.Success)
            {
                throw new InvalidOperationException("Can't login as admin");
            }
            var result = acProvider.ReportUserTrainingTaken(principalId);
        }
Esempio n. 18
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);
                    }
                }
            }
        }
Esempio n. 19
0
        public int DeleteById(int id)
        {
            SubModuleItem moduleItem;
            var           model = this.SubModuleItemModel;

            if ((moduleItem = model.GetOneById(id).Value) == null)
            {
                var error = new Error(
                    Errors.CODE_ERRORTYPE_OBJECT_NOT_FOUND,
                    ErrorsTexts.GetResultError_Subject,
                    ErrorsTexts.GetResultError_NotFound);
                this.LogError("SubModuleItem.DeleteById", error);
                throw new FaultException <Error>(error, error.errorMessage);
            }

            foreach (var quiz in moduleItem.Quizes)
            {
                var  mappings           = CompanyEventQuizMappingModel.GetAllMappedByQuizId(quiz.Id);
                bool informAboutMapping = false;
                foreach (var mapping in mappings)
                {
                    var acUri         = new Uri(mapping.CompanyAcDomain.AcServer);
                    var acProvider    = new AdobeConnectProvider(new ConnectionDetails(acUri));
                    var acProxy       = new AdobeConnectProxy(acProvider, Logger, acUri);
                    var scoInfoResult = acProxy.GetScoInfo(mapping.AcEventScoId);
                    if (scoInfoResult.Status.Code == StatusCodes.no_data)
                    {
                        CompanyEventQuizMappingModel.RegisterDelete(mapping);
                    }
                    else
                    {
                        informAboutMapping = true;
                    }
                }

                if (informAboutMapping)
                {
                    var msg   = "This item cannot be removed as it's mapped with an Event. Please delete the Mapping first.";
                    var error = new Error(
                        Errors.CODE_ERRORTYPE_USER_MESSAGE,
                        msg,
                        msg);
                    throw new FaultException <Error>(error, error.errorMessage);
                }
            }

            model.RegisterDelete(moduleItem, true);
            return(id);
        }
Esempio n. 20
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);
        }
Esempio n. 21
0
        public void WillConnectWithMultipleAcc()// using Thomas creds
        {
            var login             = "******";
            var password          = "******";
            var apiUrl            = new Uri("https://fiustg.adobeconnect.com");
            var connectionDetails = new ConnectionDetails(apiUrl);
            var provider          = new AdobeConnectProvider(connectionDetails);

            var         userCredentials = new UserCredentials(login, password, "965886535");
            LoginResult loginResult     = provider.Login(userCredentials);

            if (!loginResult.Success)
            {
                throw new InvalidOperationException("Invalid login");
            }
        }
Esempio n. 22
0
        public void WillCreateEventViaProxy()
        {
            var acApiUrl         = "https://connectstage.esynctraining.com/";
            var login            = "******";
            var password         = "******";
            var adobeConnectRoot = new Uri(acApiUrl);
            var con             = new ConnectionDetails(adobeConnectRoot);
            var acProvider      = new AdobeConnectProvider(con);
            var proxy           = new AdobeConnectProxy(acProvider, new FakeLogger(), adobeConnectRoot, String.Empty);
            var eventName       = $"__FromACLibTest{DateTime.Now:yyyy-M-d hh-mm-ss}";
            var eventStartDate  = new DateTime(2017, 5, 4, 0, 30, 0);
            var eventEndDate    = eventStartDate.AddDays(1);
            var saveEventFields = new SaveEventFields(new UserCredentials(login, password), eventName, eventStartDate, eventEndDate);

            saveEventFields.TimeZoneId = 85; //Greenwich
            var result = proxy.CreateEvent(saveEventFields);
        }
Esempio n. 23
0
        public Task <AdobeConnectUser> FindAsync(string userName, string password)
        {
            string[] parts        = userName.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            string   companyToken = parts[0];
            string   acDomain     = parts[1];
            string   acLogin      = parts[2];

            if (!_acDomainValidator.IsValid(companyToken, acDomain))
            {
                _logger?.Warn($"[UserManager.FindAsync] AC domain is not valid for companyToken. AcDomain={acDomain}");
                return(Task.FromResult <AdobeConnectUser>(null));
            }

            string   sessionToken;
            var      connectionDetails = new ConnectionDetails(new Uri(acDomain));
            var      provider          = new AdobeConnectProvider(connectionDetails);
            UserInfo acPrincipal       = TryLogin(provider, new AdobeConnectAccess(new Uri(acDomain), acLogin, password), out sessionToken);

            _logger?.Info($"[UserManager.FindAsync] ACSession={sessionToken}");

            if (acPrincipal == null)
            {
                _logger?.Warn($"[UserManager.FindAsync] Principal not found. AcDomain={acDomain}, AcLogin={acLogin}");
                return(Task.FromResult <AdobeConnectUser>(null));
            }

            var roles = new List <string>();

            if (_userAuthorizationProvider != null)
            {
                roles.AddRange(_userAuthorizationProvider.GetUserPermissions(provider, acPrincipal));
            }

            var applicationUser = new AdobeConnectUser
            {
                Id       = acPrincipal.UserId,
                UserName = acLogin,

                CompanyToken   = companyToken,
                AcDomain       = acDomain,
                AcSessionToken = sessionToken,
                Roles          = roles
            };

            return(Task.FromResult(applicationUser));
        }
Esempio n. 24
0
        protected UserInfo TryLogin(AdobeConnectProvider provider, IAdobeConnectAccess credentials, out string sessionToken)
        {
            provider.Logout();
            LoginResult result = provider.Login(new UserCredentials(credentials.Login, credentials.Password));

            if (!result.Success)
            {
                _logger?.Error(
                    $"[UserManager.TryLogin] Login failed. Login={credentials.Login}, Status={result.Status.GetErrorInfo()}");
                sessionToken = null;
                return(null);
            }

            sessionToken = result.Status.SessionInfo;
            _logger?.Info($"[UserManager.TryLogin] Success. Login={credentials.Login}, sessionToken={sessionToken}");

            return(_userGroupPermissionProvider.UserHasGroupPermission(provider, result.User) ? result.User : null);
        }
Esempio n. 25
0
        public void WillChunkRecordingsForTransactions()
        {
            var scoId      = "1064081639";
            var acApiUrl   = new Uri("https://ncvps.adobeconnect.com");
            var con        = new ConnectionDetails(acApiUrl);
            var acProvider = new AdobeConnectProvider(con);
            var proxy      = new AdobeConnectProxy(acProvider, new FakeLogger(), acApiUrl, String.Empty);

            //proxy.report
            proxy.Login(new UserCredentials("*****@*****.**", "***get-from-ltidb***"));//admin
            var recordingsSco = proxy.GetRecordingsList(scoId).Values.Select(x => x.ScoId);

            Assert.IsTrue(recordingsSco.Any());

            var transactions = proxy.ReportRecordingTransactions(recordingsSco).Values.ToList();

            Assert.IsTrue(transactions.Any());
        }
Esempio n. 26
0
        private MeetingDTO GetMeetingDTOByScoId(string scoId, AdobeConnectProvider provider)
        {
            var result = provider.GetScoInfo(scoId).ScoInfo;

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

            var permission = provider.GetScoPublicAccessPermissions(scoId).Values;

            return(this.GetMeetingDTOByScoInfo(result, permission));
        }
Esempio n. 27
0
        public void WillUpdatePassword()
        {
            var login            = "******";
            var email            = login;
            var password         = "******";
            var acApiUrl         = "https://connectstage.esynctraining.com/";
            var adobeConnectRoot = new Uri(acApiUrl);
            var con        = new ConnectionDetails(adobeConnectRoot);
            var acProvider = new AdobeConnectProvider(con);
            var proxy      = new AdobeConnectProxy(acProvider, new FakeLogger(), adobeConnectRoot, String.Empty);

            proxy.Login(new UserCredentials("*****@*****.**", "Welcome1"));//admin

            var _adobeConnectAccountService = new AdobeConnectAccountService(new FakeLogger());
            //proxy.PrincipalUpdatePassword()

            var existingPrincipalsResult = proxy.GetAllByEmail(email);

            if (!existingPrincipalsResult.Success)
            {
                return;
            }

            var existingPrincipal = existingPrincipalsResult.Values.FirstOrDefault();

            var principalSetup = new PrincipalSetup
            {
                PrincipalId = existingPrincipal?.PrincipalId,
                Email       = email,
                Login       = email,
                FirstName   = "aaa",
                LastName    = "bbb",
                SendEmail   = true,
                HasChildren = false,
                Type        = PrincipalType.user
            };
            var updatePrincipalResult = proxy.PrincipalUpdate(principalSetup, existingPrincipal != null);

            var updateResult = proxy.PrincipalUpdatePassword(existingPrincipal?.PrincipalId, password);

            var userProxy = _adobeConnectAccountService.GetProvider(new AdobeConnectAccess(new Uri(acApiUrl), email, password), true);
        }
Esempio n. 28
0
        public void WillConvertGuestToUser()
        {
            var email      = "***guest-email***";
            var acApiUrl   = new Uri("http://connectdev.esynctraining.com");
            var con        = new ConnectionDetails(acApiUrl);
            var acProvider = new AdobeConnectProvider(con);
            var proxy      = new AdobeConnectProxy(acProvider, new FakeLogger(), acApiUrl, String.Empty);

            proxy.Login(new UserCredentials("", ""));//admin
            var guestResult = proxy.ReportGuestsByLogin(email);

            if (guestResult.Values.Any())
            {
                var guest        = guestResult.Values.First();
                var updateResult = proxy.PrincipalUpdateType(guest.PrincipalId, PrincipalType.user);
                Assert.IsTrue(updateResult.Success);
                var principalInfo = proxy.GetPrincipalInfo(guest.PrincipalId);
                Assert.AreEqual(principalInfo.PrincipalInfo.Principal.Type, PrincipalType.user.ToString());
            }
        }
Esempio n. 29
0
        private AdobeConnectProvider GetProvider()
        {
            var connectionDetails = new ConnectionDetails()
            {
                ServiceUrl = Credentials.ACDomain + (Credentials.ACDomain.EndsWith("/") ? string.Empty : "/")
                             + "api/xml",
                EventMaxParticipants = 10,
                Proxy = new ProxyCredentials()
                {
                    Domain   = string.Empty,
                    Login    = string.Empty,
                    Password = string.Empty,
                    Url      = string.Empty
                }
            };
            var provider = new AdobeConnectProvider(connectionDetails);

            provider.Login(new UserCredentials(Credentials.ACUsername, Credentials.ACPassword));

            return(provider);
        }
Esempio n. 30
0
        public async Task WillRetrieveMeetingEnrollments()
        {
            var acApiUrl   = new Uri("https://nevadalearning.adobeconnect.com");
            var con        = new ConnectionDetails(acApiUrl);
            var acProvider = new AdobeConnectProvider(con);
            var proxy      = new AdobeConnectProxy(acProvider, new FakeLogger(), acApiUrl, String.Empty);
            var login      = proxy.Login(new UserCredentials("", ""));//admin
            var commonInfo = proxy.GetCommonInfo();
            var res        = proxy.GetAllMeetingEnrollments("4622234399");

            using (var httpClinet = new HttpClient())
            {
                try
                {
                    var result = await httpClinet.GetStringAsync($"https://nevadalearning.adobeconnect.com/api/xml?action=permissions-info&acl-id=4622234399&filter-permission-id=host&filter-permission-id=mini-host&filter-permission-id=view&session={commonInfo.CommonInfo.Cookie}");
                }
                catch (Exception e)
                {
                }
            }
        }