// public EventCollectionResult ReportMyEvents(int startIndex = 0, int limit = 0) // { // // act: "report-my-events" // StatusInfo status; // // var doc = this.requestProcessor.Process(Commands.ReportMyEvents, // string.Empty.AppendPagingIfNeeded(startIndex, limit).TrimStart('&'), out status); // // return ResponseIsOk(doc, status) // ? new EventCollectionResult(status, EventInfoCollectionParser.Parse(doc)) // : new EventCollectionResult(status); // } //public void GetEventDynamicQuestionAnswers() //{ //} //public void GetEventInfo() //{ //} public async Task <SaveEventResponse> CreateEvent(SaveEventFields saveEventFields) { if (saveEventFields.AdminUser == null || string.IsNullOrEmpty(saveEventFields.AdminUser.Login) || string.IsNullOrEmpty(saveEventFields.AdminUser.Password)) { throw new InvalidOperationException(nameof(saveEventFields.AdminUser)); } if (saveEventFields.StartDate == DateTime.MinValue || saveEventFields.StartDate == DateTime.MaxValue) { throw new InvalidOperationException(nameof(saveEventFields.StartDate)); } if (string.IsNullOrEmpty(saveEventFields.Name)) { throw new InvalidOperationException(nameof(saveEventFields.Name)); } // Login as in UI, get 2 cookies and owasp and use it var loginResult = requestProcessor.LoginAsOnUi(saveEventFields.AdminUser); StatusInfo status; var folderScoId = saveEventFields.FolderScoId; if (saveEventFields.FolderScoId == null) { var eventsShortcut = GetShortcutByType(ScoShortcutType.events.ToString(), out status); folderScoId = eventsShortcut.ScoId; } var myMeetings = GetShortcutByType(ScoShortcutType.my_meetings.ToString(), out status); saveEventFields.ListScoId = myMeetings.ScoId; var getResult = await requestProcessor.GetAcAdminResponseRedirectLocation(folderScoId, loginResult.Owasp); saveEventFields.EventTemplateId = getResult.EventTemplateId; var dict = AcCreateEventHelper.GetPostFormFields(saveEventFields, loginResult.Owasp); var accountId = GetCommonInfo().CommonInfo.AccountId?.ToString() ?? throw new InvalidOperationException("Can't get common info"); var result = requestProcessor.PostAcAdminRequest(new CreatingEventContainer() { EventProperties = dict, EventScoId = getResult.ScoId, FolderScoId = folderScoId, Owasp = loginResult.Owasp, PostUrl = getResult.CreateEventPostUrl, AccountId = accountId }); return(new SaveEventResponse() { EventScoId = getResult.ScoId, StartDate = saveEventFields.StartDate, EndDate = saveEventFields.EndDate, EventTitle = saveEventFields.Name }); }
public async Task <SaveEventResponse> EditEvent(SaveEventFields saveEventFields, string eventScoId, bool isTimezoneChanged) { if (saveEventFields.AdminUser == null || string.IsNullOrEmpty(saveEventFields.AdminUser.Login) || string.IsNullOrEmpty(saveEventFields.AdminUser.Password)) { throw new InvalidOperationException(nameof(saveEventFields.AdminUser)); } if (saveEventFields.StartDate == DateTime.MinValue || saveEventFields.StartDate == DateTime.MaxValue) { throw new InvalidOperationException(nameof(saveEventFields.StartDate)); } if (string.IsNullOrEmpty(saveEventFields.Name)) { throw new InvalidOperationException(nameof(saveEventFields.Name)); } // Login as in UI, get 2 cookies and owasp and use it var loginResult = requestProcessor.LoginAsOnUi(saveEventFields.AdminUser); var dict = AcCreateEventHelper.GetPostFormFieldsForEdit(saveEventFields, loginResult.Owasp); var accountId = GetCommonInfo().CommonInfo.AccountId?.ToString() ?? throw new InvalidOperationException("Can't get common info"); requestProcessor.PostEditEventAcAdminRequest(new CreatingEventContainer() { EventProperties = dict, EventScoId = eventScoId, FolderScoId = saveEventFields.FolderScoId, Owasp = loginResult.Owasp, AccountId = accountId }); if (isTimezoneChanged) { // HACK: send request second time to set correct time because it was converted to new timezone requestProcessor.PostEditEventAcAdminRequest(new CreatingEventContainer() { EventProperties = dict, EventScoId = eventScoId, FolderScoId = saveEventFields.FolderScoId, Owasp = loginResult.Owasp, AccountId = accountId }); } return(new SaveEventResponse() { EventScoId = eventScoId, StartDate = saveEventFields.StartDate, EndDate = saveEventFields.EndDate, EventTitle = saveEventFields.Name }); }
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); }
public static Dictionary <string, string> GetPostFormFields(SaveEventFields saveEventFields, string owasp) { var result = new Dictionary <string, string>(); result.Add("field-id=event-template,value", saveEventFields.EventTemplateId); result.Add("name", saveEventFields.Name); result.Add("event-type", saveEventFields.EventType); result.Add("event-category", saveEventFields.EventCategory); result.Add("list-sco-id", saveEventFields.ListScoId); result.Add("owner-permission-id", saveEventFields.OwnerPermissionId); result.Add("url-path", saveEventFields.UrlPath); result.Add("field-id=event-info,value", saveEventFields.EventInfo); result.Add("description", saveEventFields.Description); result.Add("default:password-bypass", saveEventFields.PasswordByPass.ToString().ToLower()); result.Add("default:principal-id=logged-in-access,permission-id", saveEventFields.LoggedInAccess); result.Add("catalog-view", saveEventFields.CatalogView); result.Add("default:catalog-view", saveEventFields.DefaultCatalogView); result.Add("show-in-catalog", saveEventFields.ShowInCatalog.ToString().ToLower()); result.Add("default:registration-type", saveEventFields.DefaultRegistrationType); if (saveEventFields.StartDate != DateTime.MinValue && saveEventFields.StartDate != DateTime.MaxValue) { result.Add("day:date-begin", saveEventFields.StartDate.Day.ToString().ToLower()); result.Add("month:date-begin", saveEventFields.StartDate.Month.ToString().ToLower()); result.Add("year:date-begin", saveEventFields.StartDate.Year.ToString().ToLower()); result.Add("hhmm:date-begin", saveEventFields.StartDate.ToString("HH:mm")); } if (saveEventFields.EndDate != DateTime.MinValue && saveEventFields.EndDate != DateTime.MaxValue) { result.Add("day:date-end", saveEventFields.EndDate.Day.ToString().ToLower()); result.Add("month:date-end", saveEventFields.EndDate.Month.ToString().ToLower()); result.Add("year:date-end", saveEventFields.EndDate.Year.ToString().ToLower()); result.Add("hhmm:date-end", saveEventFields.EndDate.ToString("HH:mm")); } result.Add("time-zone-id", saveEventFields.TimeZoneId.ToString().ToLower()); result.Add("override:lang", saveEventFields.Lang); result.Add("default:is-registration-limit-enabled", saveEventFields.RegistrationLimitEnabled.ToString().ToLower()); result.Add("default:tag-id=11041,enable-tag", saveEventFields.Tag11041.ToString().ToLower()); result.Add("default:tag-id=11038,enable-tag", saveEventFields.Tag11038.ToString().ToLower()); result.Add("default:tag-id=11039,enable-tag", saveEventFields.Tag11039.ToString().ToLower()); result.Add("default:tag-id=11040,enable-tag", saveEventFields.Tag11040.ToString().ToLower()); //result.Add("feature=FZEk4ljHCRBv7fhQ9Lmd4Q__", saveEventFields.Feature); result.Add("OWASP_CSRFTOKEN", owasp); return(result); }
public static Dictionary <string, string> GetPostFormFieldsForEdit(SaveEventFields saveEventFields, string owasp) { var result = new Dictionary <string, string>(); result.Add("field-id=event-template,value", saveEventFields.EventTemplateId); result.Add("name", saveEventFields.Name); result.Add("field-id=event-info,value", saveEventFields.EventInfo); result.Add("description", saveEventFields.Description); result.Add("default:principal-id=logged-in-access,permission-id", saveEventFields.LoggedInAccess); result.Add("catalog-view", saveEventFields.CatalogView); result.Add("default:catalog-view", saveEventFields.DefaultCatalogView); result.Add("show-in-catalog", saveEventFields.ShowInCatalog.ToString().ToLower()); result.Add("default:registration-type", saveEventFields.DefaultRegistrationType); if (saveEventFields.StartDate != DateTime.MinValue && saveEventFields.StartDate != DateTime.MaxValue) { result.Add("day:date-begin", saveEventFields.StartDate.Day.ToString().ToLower()); result.Add("month:date-begin", saveEventFields.StartDate.Month.ToString().ToLower()); result.Add("year:date-begin", saveEventFields.StartDate.Year.ToString().ToLower()); result.Add("hhmm:date-begin", saveEventFields.StartDate.ToString("HH:mm")); } if (saveEventFields.EndDate != DateTime.MinValue && saveEventFields.EndDate != DateTime.MaxValue) { result.Add("day:date-end", saveEventFields.EndDate.Day.ToString().ToLower()); result.Add("month:date-end", saveEventFields.EndDate.Month.ToString().ToLower()); result.Add("year:date-end", saveEventFields.EndDate.Year.ToString().ToLower()); result.Add("hhmm:date-end", saveEventFields.EndDate.ToString("HH:mm")); } result.Add("time-zone-id", saveEventFields.TimeZoneId.ToString().ToLower()); result.Add("override:lang", saveEventFields.Lang); result.Add("default:is-registration-limit-enabled", saveEventFields.RegistrationLimitEnabled.ToString().ToLower()); result.Add("default:tag-id=10007,enable-tag", false.ToString().ToLower()); result.Add("default:tag-id=10008,enable-tag", false.ToString().ToLower()); result.Add("default:tag-id=10009,enable-tag", false.ToString().ToLower()); result.Add("default:tag-id=10010,enable-tag", false.ToString().ToLower()); result.Add("feature=913", "Save"); result.Add("OWASP_CSRFTOKEN", owasp); return(result); }
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); }