ExportAssociations |
This routine enables you to export study/site/user/role associations as an XML string, optionally filtered by any of Study, Site, User and/or Role.
Input
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
assocRequestXml |
XML string containing associations request |
public static bool ExportAssociations(UserProperties user, string assocRequestXml, ref string reportXml) |
Output
· True or False - indicating overall success or failure
· reportXml - an XML string containing the requested study/site/user/role associations
The XML string can contain any number of MACRO associations, each one specifying filters represented by any combination of Study/Site/User/Role values. Note that AllStudies or AllSites must be explicitly requested for these associations to be returned; if no filters are supplied the entire list of user roles will be returned.
<macroassociations> <macroassociation study="Demostudy40"/> <macroassociation study="AllStudies"/> <macroassociation user="ncj" role="DE"/> <macroassociation site="austria1"/> <macroassociation site="AllSites" role="SysAdmin"/> </macroassociations> |
The schema for the above XML is as follows:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="macroassociations"> <xs:complexType> <xs:sequence> <xs:element ref="macroassociation" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="macroassociation"> <xs:complexType> <xs:attribute name="study" type="xs:string" use="optional"/> <xs:attribute name="site" type="xs:string" use="optional"/> <xs:attribute name="user" type="xs:string" use="optional"/> <xs:attribute name="role" type="xs:string" use="optional"/> </xs:complexType> </xs:element> </xs:schema> |
An XML string in the same format as that used for ImportAssociations will be returned, but without the Action attributes, for example:
<macroassociations> <macroassociation study="Demostudy40" site="london" user="ncj" role="DE"/> <macroassociation study="Demostudy40" site="london" user="rcw" role="DE"/> <macroassociation study="AllStudies" site="latvia" user="PaertA" role="DMgr"/> <macroassociation study="AllStudies" site="AllSites" user="theboss" role="SysAdmin"/> </macroassociations> |
The schema for the above XML is as follows:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="macroassociations"> <xs:complexType> <xs:sequence> <xs:element ref="macroassociation" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="macroassociation"> <xs:complexType> <xs:attribute name="study" use="required" type="xs:string"/> <xs:attribute name="site" use="required" type="xs:string"/> <xs:attribute name="user" use="required" type="xs:string"/> <xs:attribute name="role" use="required" type="xs:string"/> </xs:complexType> </xs:element> </xs:schema> |
If a valid XML string is being returned, the ExportAssociations function returns true. The XML output will contain only the role listings for valid studies, sites, users and roles contained in the "request" string. Non-existent studies, sites, users or roles will be ignored, as will incomplete or unrecognisable XML.
The ExportAssociations function returns false if any other errors occur (such as a failure to read the XML request string) which prevent the return of a valid XML output string.