http://www.mediawiki.org/wiki/Extension:Salesforce#SSL_Library_Files
Query
Enable wiki users to query records in Salesforce by entering their own SOQL syntax query statement. Query function handles multiple custom and standard objects.
[edit] Download instructions
Download salesforce.zip (42.2 kb)
[edit] Installation
[edit] Installing the Extension
Download the installer file to the Extensions directory of your MediaWiki installation. Uncompress the file using Winzip or a similar application using the exisiting file structure. This should extract the following files;
extensions\Salesforce
extensions\Salesforce\index.php
extensions\Salesforce\soapclient
extensions\Salesforce\soapclient\enterprise.wsdl.xml
extensions\Salesforce\soapclient\partner.wsdl.xml
extensions\Salesforce\soapclient\SforceBaseClient.php
extensions\Salesforce\soapclient\SforceEnterpriseClient.php
extensions\Salesforce\soapclient\SforceHeaderOptions.php
extensions\Salesforce\soapclient\SforcePartnerClient.php
This extension makes use of version 1.1 of Salesforce’s PHP Toolkit. The installation file already includes the required files so the tool kit does not need to be installed separately.
[edit] Required PHP Extensions
In order to use the HTTPS protocol you need to enable some of the PHP extensions. Open PHP.ini for editing. Search for “extension=php_curl.dll”. There should be a semi-colon in front of that line – remove it to enable the extension. Scroll down and find “extension=php_openssl.dll” and do the same. Now scroll down a bit further and find “extension=php_sockets.dll”. Leave this line alone, but insert a new line below it and type “extension=php_soap.dll” on that line. For some reason, this entry doesn’t appear in the default configuration. Save the file and exit.
[edit] SSL Library Files
Windows Users: Copy the SSL library files from the PHP installation directory to your Windows system directory. The two files are libeay32.dll and ssleay32.dll. They need to be copied into the system directory, usually c:\windows\system32 on an XP system. If you happen to have OpenSSL already installed on your computer you may find that these files are already installed. If they are, you should only replace them if the ones from the PHP directory are more recent. Change the extensions on the existing ones by adding ‘.bak’ just to be safe.
[edit] Modify LocalSettings.php
To install this extension, add the following to LocalSettings.php:
#Salesforce extension configuration parameters
$wgSFDC_user = “username@salesforce.com”;
$wgSFDC_pword = “password”;
$wgSFDC_allow_qry = false;
$wgSFDC_allow_desc = false;
$wgSFDC_qry_max_rows = 10;
require_once(‘extensions/Salesforce/index.php’);
[edit] Configuration parameters
$wgSFDC_user = “username@salesforce.com”; //Salesforce user id
$wgSFDC_pword = “password”; //Salesforce password
$wgSFDC_allow_qry = false; //allow users to define queries, default is false
$wgSFDC_allow_desc = false; //allow users to describe objects, default is false
$wgSFDC_qry_max_rows = 10; //for query – sets max number of records returns, overrides LIMIT in query statement
[edit] Security Concerns
[edit] Recommended Salesforce User Permission
Unlike regular SQL statements that allow for deleting and modifying record (ie SQL injection attacks), SOQL is limited to Select statements and retrieving records only. In any case, it is highly suggested that the Salesforce user specified in LocalSettings.php have a role of Read Only. Moreover, setting up a custom role and defining access to specific fields and objects can fine tune access and effectively restrict what information the wiki user can query.
[edit] Restricting Anonymous Access
Allowing anonymous users to query your Salesforce data makes all your Salesforce data available to the world. Protecting a page as described in Manual:Preventing_access#Restrict_editing_of_certain_specific_pages disables the edit tab for all users other than those in the Sysops group. However, since it does not disable the View Source tab, users can still view your query syntax.
This extension is best used in scenarios where user access is restricted to trusted individuals. To use MediaWiki as an intranet, see Extension:LDAP Authentication for a way to limit users via LDAP/Active Directory. The following modifications can be added to LocalSettings.php to restrict access to only LDAP/Active Directory users.
## restrict edit to logged in users
$wgGroupPermissions[‘*’][‘edit’] = false;
$wgGroupPermissions[‘user’][‘edit’] = true;
# This snippet prevents new registrations from anonymous users
# (Sysops can still create user accounts)
$wgGroupPermissions[‘*’][‘createaccount’] = false;
# Pages anonymous (not-logged-in) users may see
$wgWhitelistRead = array( “Main Page”, “Special:Userlogin”, “-“, “MediaWiki:Monobook.css” );
$wgGroupPermissions[‘*’][‘read’] = false;
## example of authenticating off of Active Directory for domain “example.org”
## requires SSL and Extension:LDAP Authentication
require_once( ‘LdapAuthentication.php’ );
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array( “example” );
$wgLDAPServerNames = array( “example”=>”dc01.example.org” );
$wgLDAPSearchStrings = array( “example”=>”example\\USER-NAME” );
$wgLDAPEncryptionType = array( “example”=>”ssl” );
#$wgLDAPUseSSL = true;
$wgLDAPUseSSL = array( “example”=>”true” );
$wgLDAPEncryptionType = array( “example”=>”ssl” );
$wgLDAPUseLocal = false;
$wgLDAPAddLDAPUsers = false;
$wgLDAPUpdateLDAP = false;
$wgLDAPMailPassword = false;
#$wgLDAPRetrievePrefs = true;
$wgLDAPRetrievePrefs = array( “example”=>”true” );
$wgMinimalPasswordLength = 1;
$wgLDAPDebug = 1;
$wgLDAPSearchAttributes = array(
“example”=>”sAMAccountName”
);
$wgLDAPBaseDNs = array(#
“example”=>”dc=example,dc=org”
);
The above is only an example and may not necessarily work in your environment. See Extension:LDAP Authentication for troubleshooting tips and more information.
[edit] Usage
This tag extension uses a simple markup language in the following format.
Allowable actions are query and describe.
[edit] Describe
Lists the names, api labels, and descriptive info of fields for a given standard or custom object.
[edit] Features
Any objects referenced in relationship fields are displayed an internal link. For documentation, you can create pages describing all custom and standard objects.
Picklist and multipicklist values are listed.
[edit] Syntax:
[edit] Example
Describing a standard object.
Describing a custom object (Job Posting). Note the “__c” suffix.
[edit] Query
Using this extension, users can retrieve records from Salesforce by entering a query in Salesforce Object Query Language (SOQL) syntax. For more details on SOQL and writing proper SELECT statements see http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select.htm .
[edit] Syntax
[edit] Examples
Querying a single standard object.
Querying two standard objects (Contact and Account) using a reference field (Account.Name).
Querying two standard objects (Contact and Account) using dotted notation.
Querying a custom and standard object (Job Posting and Account) using dotted notation. In this example, the Job Posting custom object has a field called Employer which reference the Account object.
Querying a custom object and two standard objects (Application, Contact, and Account) using dotted notation. In this example, the Application custom object has a fields called Contact and Account which reference the Contact and Account objects respectively.
[edit] Select Statement Syntax
The SOQL SELECT command uses the following syntax:
SELECT fieldList FROM objectType [WHERE The Condition Expression (WHERE Clause)] [ORDER BY] LIMIT ?
For more details on SOQL and writing proper SELECT statements see http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select.htm .
The $wgSFDC_qry_max_rows value specified by the administrator takes precedence over any LIMIT specified by the Wiki user. The lesser value of the two will be used.
[edit] Column Headings Syntax
Specify the header labels for the columns separated by commas. Column headers are printed in the order they are specified exactly as written. Column values are displayed in the order they appear in the query string.(With some exceptions. See note below)
For example,
Id First Last employer
0000000000L9M4qAAF Mayra A. Random Hall
0000000000L9NR6AAN Emmanuel A Tome Warner
0000000000L9OhuAAF Abena A General Malls
0000000000L9PIeAAN Kathleen A Citycorp
0000000000P5nPdAAJ Alice Aanstoosy SBCDF
0000000000L8Z4cAAF Karen Aaron Walls Fargo
0000000000MybtqAAB John Abad Harvid University
0000000000KAwe6AAD Joseph Abadi Test
0000000000L9P5qAAF Jasmine Abair UBS
0000000000O24leAAB Abdourazakhe Abani Disnay
200 record(s) returned. (10 max)
Changing the order of the columns specified does not affect the order of the values outputted, only the headers.
Account Last First ID
0000000000L9M4qAAF Mayra A. Random Hall
0000000000L9NR6AAN Emmanuel A Tome Warner
0000000000L9OhuAAF Abena A General Malls
0000000000L9PIeAAN Kathleen A Citycorp
0000000000P5nPdAAJ Alice Aanstoosy SBCDF
0000000000L8Z4cAAF Karen Aaron Walls Fargo
0000000000MybtqAAB John Abad Harvid University
0000000000KAwe6AAD Joseph Abadi Test
0000000000L9P5qAAF Jasmine Abair UBS
0000000000O24leAAB Abdourazakhe Abani Disnay
200 record(s) returned. (10 max)
To change the order of the values, change the order those fields appear in the Select statement. For example;
NOTE:
The ID field will always appear in the first column. This is a limitation in the way the Salesforce API Describe call handles the ID field. It may be corrected in later versions.
Fields for the base object will always be outputted prior to fields of referenced objects regardless of the order in which they appear in the Select statement. So that
ID Account First Name Last Name
0000000000L9M4qAAF Mayra Abernathy Random Hall
200 record(s) returned. (10 max)
The number of column headers should match the number of fields specified in the select statement. Mismatches will result in tables with missing column headers.
ID Account First Name
0000000000L9M4qAAF Mayra Abernathy Random Hall
200 record(s) returned. (10 max)
To leave a column header blank use an empty string such as
Please Note:
Column names cannot include commas
At least one column name is required.
Remember to use “__c” suffix when referencing custom objects and fields.