Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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");
            }
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public IAdobeConnectProxy GetProvider(string acDomain, UserCredentials credentials, bool login)
        {
            var apiUrl = new Uri(acDomain);

            var    connectionDetails = new ConnectionDetails(apiUrl);
            string principalId       = null;
            var    provider          = new AdobeConnectProvider(connectionDetails);

            if (login)
            {
                LoginResult result = provider.Login(credentials);
                if (!result.Success)
                {
                    _logger.Error($"AdobeConnectAccountService.GetProvider. Login failed to { acDomain }. Status: { result.Status.GetErrorInfo() }");
                    throw new InvalidOperationException($"Login to Adobe Connect failed. Status: { result.Status.GetErrorInfo() }");
                }
                principalId = result.User.UserId;
            }

            return(new AdobeConnectProxy(provider, _logger, apiUrl));
        }
Ejemplo n.º 8
0
        public IAdobeConnectProxy GetProvider(IAdobeConnectAccess credentials, bool login)
        {
            if (credentials == null)
            {
                throw new ArgumentNullException(nameof(credentials));
            }

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

            if (login)
            {
                var         userCredentials = new UserCredentials(credentials.Login, credentials.Password);
                LoginResult result          = provider.Login(userCredentials);
                if (!result.Success)
                {
                    _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));
        }
Ejemplo n.º 9
0
        public void WillGetAccountDetailsOnLocalAC()
        {
            var login             = "******";
            var password          = "******";
            var apiUrl            = new Uri("https://connect.fiu.edu");
            var connectionDetails = new ConnectionDetails(apiUrl);
            var provider          = new AdobeConnectProvider(connectionDetails);

            var         userCredentials = new UserCredentials(login, password);
            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;
        }
Ejemplo n.º 10
0
        public bool TestACConnection(ConnectionTestDTO test, out string info,
                                     out bool loginSameAsEmail)
        {
            if (test == null)
            {
                throw new ArgumentNullException(nameof(test));
            }

            loginSameAsEmail = false;
            //sharedTemplatesFolderScoId = null;
            info = string.Empty;

            if (string.IsNullOrWhiteSpace(test.password))
            {
                info = "Password is required";
                return(false);
            }

            if (!TestDomainFormat(test, out info))
            {
                return(false);
            }

            var provider = new AdobeConnectProvider(new ConnectionDetails(new Uri(test.domain)));
            var result   = provider.Login(new UserCredentials(test.login, test.password));

            if (!result.Success)
            {
                string error = FormatErrorFromAC(result);
                if (!string.IsNullOrWhiteSpace(error))
                {
                    info = error;
                }

                return(false);
            }

            CommonInfoResult commonInfo = provider.GetCommonInfo();

            if (!commonInfo.Success)
            {
                _logger.ErrorFormat("GetPasswordPolicies.GetUserInfo. AC error. {0}.", commonInfo.Status.GetErrorInfo());
                info = commonInfo.Status.GetErrorInfo();
                return(false);
            }

            if (commonInfo.CommonInfo.AccountId.HasValue)
            {
                FieldCollectionResult fields = provider.GetAclFields(commonInfo.CommonInfo.AccountId.Value);

                if (!fields.Success)
                {
                    _logger.ErrorFormat("GetPasswordPolicies.GetAclFields. AC error. {0}.", fields.Status.GetErrorInfo());
                    info = fields.Status.GetErrorInfo();
                    return(false);
                }

                //ScoContentCollectionResult sharedTemplates = provider.GetContentsByType("shared-meeting-templates");
                //if (!sharedTemplates.Success)
                //{
                //    logger.ErrorFormat("GetPasswordPolicies.get shared-meeting-templates. AC error. {0}.", sharedTemplates.Status.GetErrorInfo());
                //    info = sharedTemplates.Status.GetErrorInfo();
                //    return false;
                //}

                //sharedTemplatesFolderScoId = sharedTemplates.ScoId;

                string setting = GetField(fields, "login-same-as-email");
                loginSameAsEmail = string.IsNullOrEmpty(setting) || "YES".Equals(setting, StringComparison.OrdinalIgnoreCase);
                return(true);
            }

            _logger.Error("GetPasswordPolicies. Account is NULL. Check Adobe Connect account permissions. Admin account expected.");
            info = "Check Adobe Connect account permissions. Admin account expected.";
            return(false);
        }
Ejemplo n.º 11
0
        void RunUmdRecordingsReport()
        {
            var container = new WindsorContainer();

            WindsorIoC.Initialize(container);
            DIConfig.RegisterComponents(container);

            var logger         = IoC.Resolve <ILogger>();
            var accountService = new AdobeConnectAccountService(logger);
            //            IAdobeConnectProxy ac = accountService.GetProvider(new AdobeConnectAccess("https://webmeeting.umd.edu/", "*****@*****.**", "e$ync123UMD"), true);

            var apiUrl = new Uri("https://webmeeting.umd.edu");

            var         connectionDetails = new ConnectionDetails(apiUrl);
            var         provider          = new AdobeConnectProvider(connectionDetails);
            LoginResult loginResult       = provider.Login(new UserCredentials("*****@*****.**", "e$ync123UMD"));

            var recordings = provider.GetRecordingsList(null); //some id here

            //            var recordingsWithoutCreate = recordings.Values.Where(x => x.DateCreated == default(DateTime)).ToList();
            //            var recordingsWithoutCreateWithEnd = recordingsWithoutCreate.Where(x => x.EndDate != default(DateTime)).ToList();
            var recordingsWithoutEnd = recordings.Values.Where(x => x.EndDate == default(DateTime)).Select(x => x.ScoId);

            var result =
                recordings.Values.Where(x => recordingsWithoutEnd.All(r => r != x.ScoId) && x.ScoId != "2434849").ToList(); //2434849 - rec without start date, can't calculate duration
            double duration        = 0;
            double biggestDuration = 0;
            string biggestRecSco   = null;

            var recsAfter_20150601 = result.Where(x => x.DateCreated >= new DateTime(2015, 06, 01));

            foreach (var rec in recsAfter_20150601)
            {
                var      scoInfo = provider.GetScoInfo(rec.ScoId);
                var      rec1    = provider.GetRecordingsList(scoInfo.ScoInfo.FolderId, rec.ScoId);
                TimeSpan ts;
                if (TimeSpan.TryParse(rec1.Values.First().Duration, out ts))
                {
                    duration += ts.TotalMinutes;
                    if (ts.TotalMinutes > biggestDuration)
                    {
                        biggestDuration = ts.TotalMinutes;
                        biggestRecSco   = rec.ScoId;
                    }
                }
                else
                {
                    Console.WriteLine($"There was a problem with scoId={rec.ScoId} . Could not parse Duration={rec1.Values.First().Duration}");
                }
            }
            Console.WriteLine($"Total recordings count after 2015/05/31                   :{recsAfter_20150601.Count()}");
            Console.WriteLine($"Total recordings duration(in minutes) after 2015/05/31    :{duration}");
            Console.WriteLine($"The longest meeting duration(in minutes) after 2015/05/31 :{biggestDuration}, scoId={biggestRecSco}");
            var recsBefore20150601 = result.Where(x => x.DateCreated < new DateTime(2015, 06, 01));

            duration        = 0;
            biggestDuration = 0;
            foreach (var rec in recsBefore20150601)
            {
                var      scoInfo = provider.GetScoInfo(rec.ScoId);
                var      rec1    = provider.GetRecordingsList(scoInfo.ScoInfo.FolderId, rec.ScoId);
                TimeSpan ts;
                if (TimeSpan.TryParse(rec1.Values.First().Duration, out ts))
                {
                    duration += ts.TotalMinutes;
                    if (ts.TotalMinutes > biggestDuration)
                    {
                        biggestDuration = ts.TotalMinutes;
                        biggestRecSco   = rec.ScoId;
                    }
                }
                else
                {
                    Console.WriteLine($"There was a problem with scoId={rec.ScoId} . Could not parse Duration={rec1.Values.First().Duration}");
                }
            }
            Console.WriteLine($"Total recordings count before 2015/05/31                   :{recsBefore20150601.Count()}");
            Console.WriteLine($"Total recordings duration(in minutes) before 2015/05/31    :{duration}");
            Console.WriteLine($"The longest meeting duration(in minutes) before 2015/05/31 :{biggestDuration}, scoId={biggestRecSco}");
            Console.ReadLine();
        }
Ejemplo n.º 12
0
        public void WillGetAllByPrincipalIds()
        {
            //var proxy = Substitute.For<IAdobeConnectProxy>();
            var         ids               = new List <string>();
            var         apiUrl            = new Uri("https://fiustg.adobeconnect.com");
            var         connectionDetails = new ConnectionDetails(apiUrl);
            var         login             = "******";
            var         password          = "******";
            var         userCredentials   = new UserCredentials(login, password, "965886535");
            var         provider          = new AdobeConnectProvider(connectionDetails);
            LoginResult loginResult       = provider.Login(userCredentials);

            if (!loginResult.Success)
            {
                throw new InvalidOperationException("Invalid login");
            }
            var principalId = loginResult.User.UserId;

            var proxy = new AdobeConnectProxy(provider, new FakeLogger(), apiUrl, principalId);

            //var acProvider = Substitute.ForPartsOf<AdobeConnectProvider>();
            //acProvider.When(x => x.GetAllByPrincipalIds())
            //for (var i = 0; i < 375; i++)
            //{
            //    ids.Add(i);
            //}
            ids = new List <string>()
            {
                "969980305",
                "969994159",
                "970000385",
                "970031418",
                "988325146",
                "988325884",
                "988333621",
                "988336193",
                "988345341",
                "988345796",
                "988392645",
                "988392238",
                "988392115",
                "988390536",
                "988386250",
                "988385271",
                "988384635",
                "988383270",
                "988383256",
                "988382042",
                "988381526",
                "988374150",
                "988372782",
                "988372008",
                "988371915",
                "988371234",
                "988364932",
                "988363108",
                "988362537",
                "988361823",
                "988466848",
                "988464487",
                "988463493",
                "988463137",
                "988462642",
                "988462637",
                "988458941",
                "988458741",
                "988458278",
                "988458012",
                "988456474",
                "988449598",
                "988441839",
                "988441817",
                "988439110",
                "988438412",
                "988437927",
                "988437623",
                "988433234",
                "988432937",
                "988429393",
                "988423628",
                "988421518",
                "988419726",
                "988419367",
                "988417948",
                "988416743",
                "988415048"
            };
            var result = proxy.GetAllByPrincipalIds(ids.Select(x => x.ToString()).ToArray());

            Assert.IsTrue(result.Success);
            Assert.IsTrue(result.Values.Any());
        }