/// <summary> /// Returns the list of principals (users or groups) who have permissions to act on a SCO, /// principal, or account. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="aclId">*Required. /// The ID of a SCO, account, or principal /// that a principal has permission to act /// on. The acl-id is a sco-id, principalid, /// or account-id in other calls.</param> /// <param name="principalId">Optional. /// The ID of a user or group who has a /// permission (even if Denied or not set) to /// act on a SCO, an account, or another principal.</param> /// <param name="filter">Optional filtering parameter.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <PermissionInfo> GetPermissionsInfo(this AdobeConnectXmlAPI adobeConnectXmlApi, string aclId, string principalId, string filter) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("permissions-info", String.Format("acl-id={0}&principal-id={1}&filter-definition={2}", aclId, principalId, filter)); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <PermissionInfo> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//permissions/principal"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <PermissionInfo>(itemInfo.CreateReader())); return(resultStatus); }
/// <summary> /// Provides a complete list of users and groups, including primary groups. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="groupId">The group identifier.</param> /// <param name="filterBy">Optional filtering parameter.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <PrincipalListItem> GetPrincipalList(this AdobeConnectXmlAPI adobeConnectXmlApi, string groupId, string filterBy) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("principal-list", String.Format("group-id={0}&{1}", groupId, filterBy)); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <PrincipalListItem> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//principal-list/principal"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <PrincipalListItem>(itemInfo.CreateReader())); return(resultStatus); }
public static async Task <ApiStatusWithSco> ScoGenericOperation(AdobeConnectXmlAPI adobeConnectXmlApi, Sco sco, string operation) { var response = ApiStatusWithSco.FromApiStatus(await adobeConnectXmlApi.ProcessApiRequest(operation, Helpers.StructToQueryString(sco, true))); if (response.Code != StatusCodes.OK || response.ResultDocument == null) { return(response); } XElement scoNode = response.ResultDocument.XPathSelectElement("//sco"); if (scoNode == null) { return(response); } try { response.Sco = XmlSerializerHelpersGeneric.FromXML <Sco>(scoNode.CreateReader()); response.Sco.FullUrl = adobeConnectXmlApi.ResolveFullUrl(response.Sco.UrlPath); } catch (Exception ex) { response.Code = StatusCodes.Invalid; response.SubCode = StatusSubCodes.Format; response.InnerException = ex; throw ex.InnerException; } return(response); }
/// <summary> /// Provides information about the folders relevant to the current user. These include a Folder for /// the user’s current meetings, a Folder for the user’s Content, as well as folders above them in the /// navigation hierarchy. /// To determine the URL of a SCO, concatenate the url-path returned by sco-info, scocontents, /// or sco-expanded-contents with the domain-Name returned by sco-shortcuts. /// For example, you can concatenate these two strings: /// - http://test.server.com (the domain-Name returned by sco-shortcuts) /// - /f2006123456/ (the url-path returned by sco-info, sco-contents, or scoexpanded-contents) /// The result is this URL: http://test.server.com/f2006123456/ /// You can also call sco-contents with the sco-id of a Folder returned by sco-shortcuts to /// see the contents of the Folder. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <ScoShortcut> GetSCOshortcuts(this AdobeConnectXmlAPI adobeConnectXmlApi) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("sco-shortcuts", null); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <ScoShortcut> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//shortcuts/sco"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <ScoShortcut>(itemInfo.CreateReader())); return(resultStatus); }
public static async Task <EnumerableResultStatus <Sco> > GetFolderContents(this AdobeConnectXmlAPI adobeConnectXmlApi, string folderId) { var s = await adobeConnectXmlApi.ProcessApiRequest("sco-contents", String.Format("sco-id={0}", folderId)); var result = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <Sco> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(result); } var scoList = s.ResultDocument.XPathSelectElements("//sco"); if (scoList == null) { return(result); } result.Result = scoList.Select(scoNode => { var sco = XmlSerializerHelpersGeneric.FromXML <Sco>(scoNode.CreateReader()); sco.FullUrl = adobeConnectXmlApi.ResolveFullUrl(sco.UrlPath); return(sco); }).ToList(); return(result); }
/// <summary> /// Provides information about each event the current user has attended or is scheduled to attend. /// The user can be either a Host or a participant in the event. The events returned are those in the /// user’s my-events Folder. /// To obtain information about all events on your Enterprise Server or in your Enterprise Hosted /// account, call sco-shortcuts to get the sco-id of the events Folder. Then, call scocontents /// with the sco-id to list all events. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <EventInfo> ReportMyEvents(this AdobeConnectXmlAPI adobeConnectXmlApi) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("report-my-events", null); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <EventInfo> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//my-events/event"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <EventInfo>(itemInfo.CreateReader(), new XmlRootAttribute("event"))); return(resultStatus); }
/// <summary> /// Returns information about principal-to-SCO transactions on your server or in your hosted account. /// A transaction is an instance of one principal visiting one SCO. The SCO can be an Acrobat /// Connect Professional Meeting, Course, document, or any Content on the server. /// Note: this call to report-bulk-consolidated-transactions, with filter-Type=Meeting, returns only /// users who logged in to the Meeting as participants, not users who entered the Meeting as guests. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="filterBy">optional 'filter by' params</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static EnumerableResultStatus <TransactionInfo> Report_ConsolidatedTransactions(this AdobeConnectXmlAPI adobeConnectXmlApi, string filterBy) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("report-bulk-consolidated-transactions", filterBy); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <TransactionInfo> >(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } IEnumerable <XElement> list; try { IEnumerable <XElement> nodeData = s.ResultDocument.XPathSelectElements("//row"); list = nodeData as IList <XElement> ?? nodeData; } catch (Exception ex) { throw; } resultStatus.Result = list.Select(itemInfo => XmlSerializerHelpersGeneric.FromXML <TransactionInfo>(itemInfo.CreateReader(), new XmlRootAttribute("row"))); return(resultStatus); }
/// <summary> /// Provides information about a SCO on Connect Enterprise. The object can have any valid /// SCO Type. See Type for a list of the allowed SCO types. /// The response includes the account the SCO belongs to, the dates it was created and last /// modified, the owner, the URL that reaches it, and other data. For some types of SCOs, the /// response also includes information about a template from which this SCO was created. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="scoId">Meeting id</param> /// <returns> /// <see cref="EnumerableResultStatus{T}" /> /// </returns> public static MeetingDetailStatus GetMeetingDetail(this AdobeConnectXmlAPI adobeConnectXmlApi, string scoId) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("sco-info", String.Format("sco-id={0}", scoId)); var resultStatus = Helpers.WrapBaseStatusInfo <MeetingDetailStatus>(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } try { XElement nodeData = s.ResultDocument.XPathSelectElement("//sco"); if (nodeData == null || !nodeData.HasElements) { return(null); } resultStatus.Result = XmlSerializerHelpersGeneric.FromXML <MeetingDetail>(nodeData.CreateReader(), new XmlRootAttribute("sco")); resultStatus.Result.FullUrl = adobeConnectXmlApi.ResolveFullUrl(resultStatus.Result.UrlPath); return(resultStatus); } catch (Exception ex) { throw; } }
/// <summary> /// Creates metadata for a SCO, or updates existing metadata describing a SCO. /// Call sco-update to create metadata only for SCOs that represent Content, including /// meetings. You also need to upload Content files with either sco-upload or Connect Enterprise Manager. /// You must provide a folder-id or a sco-id, but not both. If you pass a folder-id, scoupdate /// creates a new SCO and returns a sco-id. If the SCO already exists and you pass a /// sco-id, sco-update updates the metadata describing the SCO. /// After you create a new SCO with sco-update, call permissions-update to specify which /// users and groups can access it. /// </summary> /// <returns> /// <see cref="ApiStatus" /> /// </returns> internal ApiStatus ScoUpdate(MeetingUpdateItem meetingUpdateItem, out MeetingDetail meetingDetail) { meetingDetail = null; if (meetingUpdateItem == null) { return(null); } string cmdParams = Helpers.StructToQueryString(meetingUpdateItem, true); ApiStatus s = this.ProcessApiRequest("sco-update", cmdParams); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(s); } //notice: no '/sco' will be returned during update XElement meetingDetailNode = s.ResultDocument.XPathSelectElement("//sco"); if (meetingDetailNode == null) { return(s); } try { meetingDetail = XmlSerializerHelpersGeneric.FromXML <MeetingDetail>(meetingDetailNode.CreateReader()); meetingDetail.FullUrl = this.ResolveFullUrl(meetingDetail.UrlPath); } catch (Exception ex) { s.Code = StatusCodes.Invalid; s.SubCode = StatusSubCodes.Format; s.InnerException = ex; //rollback: delete the meeting if (!string.IsNullOrEmpty(meetingDetail.ScoId)) { this.ScoDelete(new[] { meetingDetail.ScoId }); } throw ex.InnerException; } return(s); }
/// <summary> /// Provides information about one principal, either a user or a group. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="principalId">The principal identifier.</param> /// <returns> /// <see cref="PrincipalInfo" /> /// </returns> /// <exception cref="System.ArgumentNullException">principalId</exception> public static PrincipalInfoStatus GetPrincipalInfo(this AdobeConnectXmlAPI adobeConnectXmlApi, string principalId) { if (String.IsNullOrEmpty(principalId)) { throw new ArgumentNullException("principalId"); } ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("principal-info", String.Format("principal-id={0}", principalId)); var principalInfoStatus = Helpers.WrapBaseStatusInfo <PrincipalInfoStatus>(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(null); } var principalInfo = new PrincipalInfo(); try { XElement contactData = s.ResultDocument.XPathSelectElement("//contact"); if (contactData != null) { principalInfo.Contact = XmlSerializerHelpersGeneric.FromXML <Contact>(contactData.CreateReader()); } XElement preferencesData = s.ResultDocument.XPathSelectElement("//preferences"); if (preferencesData != null) { principalInfo.Preferences = XmlSerializerHelpersGeneric.FromXML <Preferences>(preferencesData.CreateReader()); } XElement principalData = s.ResultDocument.XPathSelectElement("//principal"); if (principalData != null) { principalInfo.PrincipalData = XmlSerializerHelpersGeneric.FromXML <Principal>(principalData.CreateReader()); } } catch (Exception ex) { throw; } principalInfoStatus.Result = principalInfo; return(principalInfoStatus); }
/// <summary> /// Creates or updates a user or group. The user or group (that is, the principal) is created or /// updated in the same account as the user making the call. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <param name="principalSetup"><see cref="PrincipalSetup" /></param> /// <param name="principal"><see cref="Principal" /></param> /// <returns> /// <see cref="ApiStatus" /> /// </returns> public static async Task <ApiStatusWithPrincipal> PrincipalUpdate(this AdobeConnectXmlAPI adobeConnectXmlApi, PrincipalSetup principalSetup) { string cmdParams = Helpers.StructToQueryString(principalSetup, true); ApiStatusWithPrincipal s = ApiStatusWithPrincipal.FromApiStatus(await adobeConnectXmlApi.ProcessApiRequest("principal-update", cmdParams)); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(s); } s.Principal = XmlSerializerHelpersGeneric.FromXML <Principal>(s.ResultDocument.XPathSelectElement("//principal").CreateReader()); return(s); }
/// <summary> /// Returns the list of all rooms /// </summary> /// <remarks This function facilates the need to return the list of all /// urls/rooms for admin view /// <returns><see cref="List<List<bool>>"/>List of List of strings {}</returns> public static EnumerableResultStatus <MeetingItem> GetSharedList(AdobeConnectXmlAPI adobeConnectXmlApi) { var sharedMeetings = adobeConnectXmlApi.GetMeetingShortcuts().Result.FirstOrDefault <ScoShortcut>(); var scoId = (sharedMeetings as ScoShortcut).ScoId; var expandedContents = adobeConnectXmlApi.ProcessApiRequest("sco-expanded-contents", String.Format("sco-id={0}&filter-type=meeting", scoId)); var resultStatus = Helpers.WrapBaseStatusInfo <EnumerableResultStatus <MeetingItem> >(expandedContents); var folder = expandedContents.ResultDocument.Descendants("sco").Where(p => p.Attribute("folder-id").Value == scoId); resultStatus.Result = folder.Select(meeting => XmlSerializerHelpersGeneric.FromXML <MeetingItem>(meeting.CreateReader(), new XmlRootAttribute("sco"))); return(resultStatus); }
internal IEnumerable <MeetingItem> PreProcessMeetingItems(IEnumerable <XElement> list, XmlRootAttribute xmlRootAttribute) { IEnumerable <MeetingItem> meetingItems = list.Select(meetingInfo => XmlSerializerHelpersGeneric.FromXML <MeetingItem>(meetingInfo.CreateReader(), xmlRootAttribute)); foreach (var meetingItem in meetingItems) { //NOTE: if Folder => date-begin is null meetingItem.Duration = meetingItem.DateEnd.Subtract(meetingItem.DateBegin); if (!string.IsNullOrEmpty(meetingItem.UrlPath)) { Uri uri = new Uri(this.settings.ServiceURL); meetingItem.FullUrl = uri.GetComponents(UriComponents.SchemeAndServer, UriFormat.SafeUnescaped) + meetingItem.UrlPath; } yield return(meetingItem); } }
public void QuotaEntity_CanSerializeAndDeserialize() { QuotaInfo qi = new QuotaInfo() { QuotaList = new List <Quota> { new Quota { AclId = 1, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5 }, new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 } } }; string s = XmlSerializerHelpersGeneric.ToXML(qi); QuotaInfo r = XmlSerializerHelpersGeneric.FromXML <QuotaInfo>(s); Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId); }
/// <summary> /// Returns the number of concurrent Meeting participants you can have is determined by your Adobe Connect license. /// </summary> /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param> /// <returns> /// <see cref="QuotaInfoStatus" /> /// </returns> public static QuotaInfoStatus Report_Quotas(this AdobeConnectXmlAPI adobeConnectXmlApi) { ApiStatus s = adobeConnectXmlApi.ProcessApiRequest("report-quotas", String.Empty); var resultStatus = Helpers.WrapBaseStatusInfo <QuotaInfoStatus>(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(resultStatus); } try { resultStatus.Result = XmlSerializerHelpersGeneric.FromXML <QuotaInfo>(s.ResultDocument.Descendants("report-quotas").FirstOrDefault().CreateReader()); return(resultStatus); } catch (Exception ex) { throw; } }
public void QuotaEntity_CanDeserialize() { QuotaInfo qi = new QuotaInfo() { QuotaList = new List <Quota> { new Quota { AclId = 838570243, Limit = 2, QuotaId = "tstquota", SoftLimit = 4, Used = 5, DateBegin = new DateTime(2009, 03, 31, 08, 07, 59, 180, DateTimeKind.Utc) }, new Quota { AclId = 5, Limit = 6, QuotaId = "tstquota2", SoftLimit = 7, Used = 8 } } }; string s = "<report-quotas> <quota acl-id=\"838570243\" quota-id=\"download-quota\" used=\"0\" limit=\"10\" soft-limit=\"10\"> <date-begin>2009-03-31T10:07:59.180+02:00</date-begin> <date-end>3000-01-01T01:00:00.537+01:00</date-end> </quota></report-quotas>"; QuotaInfo r = XmlSerializerHelpersGeneric.FromXML <QuotaInfo>(s); Assert.AreEqual(qi.QuotaList.First().AclId, r.QuotaList.First().AclId); Assert.AreEqual(qi.QuotaList.First().DateBegin, r.QuotaList.First().DateBegin); }
/// <summary> /// Returns information about currently logged in user. /// </summary> /// <returns> /// <see cref="UserInfo" /> /// </returns> public async Task <UserInfoStatus> GetUserInfo() { ApiStatus s = await this.ProcessApiRequest("common-info", null); var userInfoStatus = Helpers.WrapBaseStatusInfo <UserInfoStatus>(s); if (s.Code != StatusCodes.OK || s.ResultDocument == null) { return(null); } try { var userInfo = XmlSerializerHelpersGeneric.FromXML <UserInfo>(s.ResultDocument.Descendants("user").FirstOrDefault().CreateReader()); userInfoStatus.Result = userInfo; return(userInfoStatus); } catch (Exception ex) { throw ex.InnerException; } }