Skip to content

Commit

Permalink
Adding support for sharing rules (#267)
Browse files Browse the repository at this point in the history
* Ready for test/review

* Adding sharingGuestRule

* wip

* Hopefully ready

* Middle moise button stupidity

* Ready to go

* Ready to test again

Co-authored-by: Scot P. Floess <[email protected]>
  • Loading branch information
pcon and Scot P. Floess authored Feb 13, 2020
1 parent c296dc0 commit 08e9f62
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 68 deletions.
59 changes: 55 additions & 4 deletions ant/1.1/properties/sfdc.metadata.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# properties defined below...
#
sf.dirs.folderBased = dashboards documents email reports
sf.dirs.nonFolderBased = assignmentRules escalationRules applications classes components datacategorygroups entitlementTemplates entitlementProcesses milestoneTypes homePageComponents homePageLayouts labels layouts letterhead objects objectTranslations pages portals profiles remoteSiteSettings reportTypes scontrols sites staticresources tabs triggers weblinks workflows permissionsets flows flowDefinitions callCenters globalPicklists globalValueSets globalValueSetTranslations standardValueSets customMetadata liveChatAgentConfigs liveChatButtons liveChatDeployments liveChatSensitiveDataRules
sf.dirs.nonFolderBased = assignmentRules escalationRules applications classes components datacategorygroups entitlementTemplates entitlementProcesses milestoneTypes homePageComponents homePageLayouts labels layouts letterhead objects objectTranslations pages portals profiles remoteSiteSettings reportTypes scontrols sites staticresources tabs triggers weblinks workflows permissionsets flows flowDefinitions callCenters globalPicklists globalValueSets globalValueSetTranslations standardValueSets customMetadata liveChatAgentConfigs liveChatButtons liveChatDeployments liveChatSensitiveDataRules sharingCriteriaRule sharingOwnerRule sharingTerritoryRule sharingGuestRule accountSharingRules campaignSharingRules caseSharingRules contactSharingRules leadSharingRules opportunitySharingRules accountTerritorySharingRules customObjectSharingRules userSharingRules

#
# All the supported directories - each directory has a corresponding metadata name.
Expand Down Expand Up @@ -83,6 +83,21 @@ sf.includes.liveChatButtons = *.liveChatButton
sf.includes.liveChatDeployments = *.liveChatDeployments
sf.includes.liveChatSensitiveDataRules = *.liveChatSensitiveDataRule

sf.includes.sharingCriteriaRule = *.sharingCriteriaRule
sf.includes.sharingGuestRule = *.sharingGuestRule
sf.includes.sharingOwnerRule = *.sharingOwnerRule
sf.includes.sharingTerritoryRule = *.sharingTerritoryRule

sf.includes.accountSharingRules = *.sharingRule
sf.includes.campaignSharingRules = *.sharingRule
sf.includes.caseSharingRules = *.sharingRule
sf.includes.contactSharingRules = *.sharingRule
sf.includes.leadSharingRules = *.sharingRule
sf.includes.opportunitySharingRules = *.sharingRule
sf.includes.accountTerritorySharingRules = *.sharingRule
sf.includes.customObjectSharingRules = *.sharingRule
sf.includes.userSharingRules = *.sharingRule

#
# The suffixes to remove based on sf.suffix.[dir name]
#
Expand Down Expand Up @@ -124,6 +139,10 @@ sf.suffix.liveChatAgentConfigs = .liveChatAgent
sf.suffix.liveChatButtons = .liveChatButton
sf.suffix.liveChatDeployments = .liveChatDeployment
sf.suffix.liveChatSensitiveDataRules = .liveChatSensitiveDataRule
sf.suffix.sharingCriteriaRule = .sharingCriteriaRule
sf.suffix.sharingOwnerRule = .sharingOwnerRule
sf.suffix.sharingTerritoryRule = .sharingTerritoryRule
sf.suffix.sharingGuestRule = .sharingGuestRule

#
# When performing diffs, these are the directories
Expand Down Expand Up @@ -213,6 +232,22 @@ sf.metadata.liveChatButtons = LiveChatButton
sf.metadata.liveChatDeployments = LiveChatDeployment
sf.metadata.liveChatSensitiveDataRules = LiveChatSensitiveDataRules

sf.metadata.sharingCriteriaRule = SharingCriteriaRule
sf.metadata.sharingOwnerRule = SharingOwnerRule
sf.metadata.sharingTerritoryRule = SharingTerritoryRule
sf.metadata.sharingGuestRule = SharingGuestRule

sf.metadata.accountSharingRules = AccountSharingRules
sf.metadata.campaignSharingRules = CampaignSharingRules
sf.metadata.caseSharingRules = CaseSharingRules
sf.metadata.contactSharingRules = ContactSharingRules
sf.metadata.leadSharingRules = LeadSharingRules
sf.metadata.opportunitySharingRules = OpportunitySharingRules
sf.metadata.accountTerritorySharingRules = AccountTerritorySharingRules
sf.metadata.customObjectSharingRules = CustomObjectSharingRules
sf.metadata.userSharingRules = UserSharingRules
sf.metadata.sharingSets = SharingSet

#
# The directories for which metadata is mapped. The property
# named sf.dir.[meta data] has as its value the directory for
Expand Down Expand Up @@ -264,9 +299,25 @@ sf.dir.LiveChatButtons = liveChatButton
sf.dir.LiveChatDeployments = liveChatDeployement
sf.dir.LiveChatSensitiveDataRules = liveChatSensitiveDataRule

sf.dir.SharingCriteriaRule = sharingCriteriaRule
sf.dir.SharingOwnerRule = sharingOwnerRule
sf.dir.SharingTerritoryRule = sharingTerritoryRule
sf.dir.SharingGuestRule = sharingGuestRule

sf.dir.AccountSharingRules = accountSharingRules
sf.dir.CampaignSharingRules = campaignSharingRules
sf.dir.CaseSharingRules = caseSharingRules
sf.dir.ContactSharingRules = contactSharingRules
sf.dir.LeadSharingRules = leadSharingRules
sf.dir.OpportunitySharingRules = opportunitySharingRules
sf.dir.AccountTerritorySharingRules = accountTerritorySharingRules
sf.dir.CustomObjectSharingRules = customObjectSharingRules
sf.dir.UserSharingRules = userSharingRules
sf.dir.SharingSet = sharingSets

#
# Fixed members for objects.
#
#sharingSets
sf.members.objects.values = Account AccountContactRole Activity Asset AssetRelationship Campaign CampaignMember Case CaseComment CaseContactRole Contact ContentVersion Contract ContractContactRole ContractLineItem Entitlement EntitlementContact EntityMilestone Event ExternalEventMapping Idea Lead LiveChatTranscript LiveChatTranscriptEvent LiveChatVisitor Opportunity OpportunityContactRole OpportunityLineItem PartnerRole Product2 Question QuickTextAction Reply Scorecard ServiceContract Site SnapshotAuditEvent SnapshotBin SnapshotConfig Solution Task User UserLicense
sf.members.objects.name = sf.metadata.objects

Expand All @@ -282,10 +333,10 @@ sf.members = sf.members.objects sf.members.standardValueSets
#
# Denotes which directories support an "all" deploy/retrive.
#
sf.all = assignmentRules escalationRules classes objects components pages triggers applications labels objectTranslations weblinks sites tabs datacategorygroups entitlementTemplates entitlementProcesses milestoneTypes homePageComponents homePageLayouts layouts permissionsets portals profiles remoteSiteSettings report reportTypes scontrols staticResources translations workflows flows
sf.all = assignmentRules escalationRules classes objects components pages triggers applications labels objectTranslations weblinks sites tabs datacategorygroups entitlementTemplates entitlementProcesses milestoneTypes homePageComponents homePageLayouts layouts permissionsets portals profiles remoteSiteSettings report reportTypes scontrols staticResources translations workflows flows sharingCriteriaRule sharingOwnerRule sharingTerritoryRule sharingGuestRule accountSharingRules campaignSharingRules caseSharingRules contactSharingRules leadSharingRules opportunitySharingRules accountTerritorySharingRules customObjectSharingRules userSharingRules sharingSets

#
# Additional ancillary properties
#
sf.version = 39.0
sf.version = 48.0
sf.namespace = http://soap.sforce.com/2006/04/metadata
172 changes: 110 additions & 62 deletions ant/1.1/util/sfdc-util.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ ${sfdc-util.SF-JAR.PATH}

<!-- =========================================================================================== -->

<scriptdef name="createPackageXmlChildren" uri="http://www.redhat.com/sfdc" language="beanshell" description="Computes the XSLT to apply using the sfdcignore file">
<scriptdef name="createPackageXmlChildren" uri="http://www.redhat.com/sfdc" language="beanshell" description="Creates the package XML for children">
<classpath refid="solenopsis.script.PATH"/>

<attribute name="property"/>
Expand Down Expand Up @@ -260,15 +260,23 @@ ${sfdc-util.SF-JAR.PATH}
xmlMap.put("remoteSiteSettings", "RemoteSiteSetting");
xmlMap.put("authproviders", "AuthProvider");
xmlMap.put("sites", "CustomSite");
xmlMap.put("leadSharingRules", "LeadSharingRules");
xmlMap.put("sharingCriteriaRule", "SharingCriteriaRule");
xmlMap.put("sharingGuestRule", "SharingGuestRule");
xmlMap.put("sharingOwnerRule", "SharingOwnerRule");
xmlMap.put("sharingTerritoryRule", "SharingTerritoryRule");
xmlMap.put("accountSharingRules", "AccountSharingRules");
xmlMap.put("campaignSharingRules", "CampaignSharingRules");
xmlMap.put("caseSharingRules", "CaseSharingRules");
xmlMap.put("contactSharingRules", "ContactSharingRules");
xmlMap.put("leadSharingRules", "LeadSharingRules");
xmlMap.put("opportunitySharingRules", "OpportunitySharingRules");
xmlMap.put("accountSharingRules", "AccountSharingRules");
xmlMap.put("accountTerritorySharingRules", "AccountTerritorySharingRules");
xmlMap.put("customObjectSharingRules", "CustomObjectSharingRules");
xmlMap.put("userSharingRules", "UserSharingRules");
xmlMap.put("sharingSets", "SharingSet");
xmlMap.put("communities", "Community");
xmlMap.put("callCenters", "CallCenter");
xmlMap.put("entitlementProcesses", "EntitlementProcess");
Expand Down Expand Up @@ -336,15 +344,24 @@ ${sfdc-util.SF-JAR.PATH}
suffixMap.put("remoteSiteSettings", "remoteSite");
suffixMap.put("authproviders", "authprovider");
suffixMap.put("sites", "site");
suffixMap.put("leadSharingRules", "sharingRules");
suffixMap.put("sharingCriteriaRule", "sharingRules");
suffixMap.put("sharingGuestRule", "sharingRules");
suffixMap.put("sharingOwnerRule", "sharingRules");
suffixMap.put("sharingTerritoryRule", "sharingRules");
suffixMap.put("accountSharingRules", "sharingRules");
suffixMap.put("campaignSharingRules", "sharingRules");
suffixMap.put("caseSharingRules", "sharingRules");
suffixMap.put("contactSharingRules", "sharingRules");
suffixMap.put("leadSharingRules", "sharingRules");
suffixMap.put("opportunitySharingRules", "sharingRules");
suffixMap.put("accountSharingRules", "sharingRules");
suffixMap.put("accountTerritorySharingRules", "sharingRules");
suffixMap.put("customObjectSharingRules", "sharingRules");
suffixMap.put("userSharingRules", "sharingRules");
suffixMap.put("sharingSets", "sharingRules");
suffixMap.put("communities", "community");
suffixMap.put("callCenters", "callCenter");
suffixMap.put("entitlementProcesses", "entitlementProcess");
Expand All @@ -366,62 +383,76 @@ ${sfdc-util.SF-JAR.PATH}
suffixMap.put("entitlementProcesses", "entitlementProcess");
suffixMap.put("milestoneTypes", "milestoneType");
Set wildcardSet = new TreeSet(); // Dir name to wildcard...
wildcardSet.add("installedPackages");
wildcardSet.add("staticresources");
wildcardSet.add("scontrols");
wildcardSet.add("components");
wildcardSet.add("pages");
wildcardSet.add("queues");
wildcardSet.add("dataSources");
wildcardSet.add("roles");
wildcardSet.add("groups");
wildcardSet.add("reportTypes");
wildcardSet.add("layouts");
wildcardSet.add("weblinks");
wildcardSet.add("quickActions");
wildcardSet.add("flexipages");
wildcardSet.add("tabs");
wildcardSet.add("customApplicationComponents");
wildcardSet.add("applications");
wildcardSet.add("portals");
wildcardSet.add("flows");
wildcardSet.add("flowDefinitons");
wildcardSet.add("workflows");
wildcardSet.add("assignmentRules");
wildcardSet.add("autoResponseRules");
wildcardSet.add("postTemplates");
wildcardSet.add("homePageComponents");
wildcardSet.add("homePageLayouts");
wildcardSet.add("objectTranslations");
wildcardSet.add("classes");
wildcardSet.add("triggers");
wildcardSet.add("profiles");
wildcardSet.add("permissionsets");
wildcardSet.add("datacategorygroups");
wildcardSet.add("remoteSiteSettings");
wildcardSet.add("authproviders");
wildcardSet.add("sites");
wildcardSet.add("sharingSets");
wildcardSet.add("communities");
wildcardSet.add("callCenters");
wildcardSet.add("entitlementProcesses");
wildcardSet.add("milestoneTypes");
wildcardSet.add("entitlementTemplates");
wildcardSet.add("connectedApps");
wildcardSet.add("appMenus");
wildcardSet.add("siteDotComSites");
wildcardSet.add("skills");
wildcardSet.add("liveChatAgentConfigs");
wildcardSet.add("liveChatButtons");
wildcardSet.add("liveChatDeployments");
wildcardSet.add("liveChatSensitiveDataRules");
wildcardSet.add("globalPicklists");
wildcardSet.add("globalValueSets");
wildcardSet.add("globalValueSetTranslations");
wildcardSet.add("standardValueSets");
wildcardSet.add("entitlementProcesses");
wildcardSet.add("milestoneTypes");
Set wildcardSet = new TreeSet(); // Member name to wildcard...
wildcardSet.add("InstalledPackages");
wildcardSet.add("Staticresources");
wildcardSet.add("Scontrols");
wildcardSet.add("Components");
wildcardSet.add("Pages");
wildcardSet.add("Queues");
wildcardSet.add("DataSources");
wildcardSet.add("Roles");
wildcardSet.add("Groups");
wildcardSet.add("ReportTypes");
wildcardSet.add("Layouts");
wildcardSet.add("Weblinks");
wildcardSet.add("QuickActions");
wildcardSet.add("Flexipages");
wildcardSet.add("Tabs");
wildcardSet.add("CustomApplicationComponents");
wildcardSet.add("Applications");
wildcardSet.add("Portals");
wildcardSet.add("Flows");
wildcardSet.add("FlowDefinitons");
wildcardSet.add("Workflows");
wildcardSet.add("AssignmentRules");
wildcardSet.add("AutoResponseRules");
wildcardSet.add("PostTemplates");
wildcardSet.add("HomePageComponents");
wildcardSet.add("HomePageLayouts");
wildcardSet.add("ObjectTranslations");
wildcardSet.add("Classes");
wildcardSet.add("Triggers");
wildcardSet.add("Profiles");
wildcardSet.add("Permissionsets");
wildcardSet.add("DataCategoryGroups");
wildcardSet.add("RemoteSiteSettings");
wildcardSet.add("AuthProviders");
wildcardSet.add("Sites");
wildcardSet.add("SharingSets");
wildcardSet.add("SharingRules");
wildcardSet.add("SharingCriteriaRule");
wildcardSet.add("SharingGuestRule");
wildcardSet.add("SharingOwnerRule");
wildcardSet.add("SharingTerritoryRule");
wildcardSet.add("AccountSharingRules");
wildcardSet.add("CampaignSharingRules");
wildcardSet.add("CaseSharingRules");
wildcardSet.add("ContactSharingRules");
wildcardSet.add("LeadSharingRules");
wildcardSet.add("OpportunitySharingRules");
wildcardSet.add("AccountTerritorySharingRules");
wildcardSet.add("CustomObjectSharingRules");
wildcardSet.add("UserSharingRules");
wildcardSet.add("SharingSets");
wildcardSet.add("Communities");
wildcardSet.add("CallCenters");
wildcardSet.add("EntitlementProcesses");
wildcardSet.add("MilestoneTypes");
wildcardSet.add("EntitlementTemplates");
wildcardSet.add("ConnectedApps");
wildcardSet.add("AppMenus");
wildcardSet.add("SiteDotComSites");
wildcardSet.add("Skills");
wildcardSet.add("LiveChatAgentConfigs");
wildcardSet.add("LiveChatButtons");
wildcardSet.add("LiveChatDeployments");
wildcardSet.add("LiveChatSensitiveDataRules");
wildcardSet.add("GlobalPicklists");
wildcardSet.add("GlobalValueSets");
wildcardSet.add("GlobalValueSetTranslations");
wildcardSet.add("StandardValueSets");
Set folderSet = new TreeSet(); // Dir name to folder.
folderSet.add("reports");
Expand Down Expand Up @@ -524,7 +555,9 @@ ${sfdc-util.SF-JAR.PATH}
}
void addName(StringBuilder sb, String key) {
sb.append(" <name>").append(xmlMap.get(key)).append("</name>\n");
if (null != xmlMap.get(key)) {
sb.append(" <name>").append(xmlMap.get(key)).append("</name>\n");
}
}
void addTypes(StringBuilder sb, String key, TreeSet files) {
Expand Down Expand Up @@ -566,6 +599,19 @@ ${sfdc-util.SF-JAR.PATH}
}
}
void addWildcards(StringBuilder sb, Set wildcardSet) {
if (null == wildcardSet) {
return;
}
for (String wildcard : wildcardSet) {
sb.append(" <types>\n");
sb.append(" <members>*</members>\n");
sb.append(" <name>").append(wildcard).append("</name>\n");
sb.append(" </types>\n");
}
}
void addFields(StringBuilder sb, String fieldList) {
if (null == fieldList) {
return;
Expand All @@ -583,6 +629,8 @@ ${sfdc-util.SF-JAR.PATH}
addTypes(sb, key, elementMap.get(key));
}
addWildcards(sb, wildcardSet);
addFields(sb, fieldList);
sb.append(" <version>").append(attributes.get("version")).append("</version>\n");
Expand Down
5 changes: 3 additions & 2 deletions ant/solenopsis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
<property name="solenopsis.bsh.HOME" value="${solenopsis.root.HOME}/../bsh"/>

<import file="${solenopsis.VERSION}/solenopsis-build.xml"/>

<target name="proxy">
<property name="proxy.port" value="${solenopsis.proxy.port}"/>
<property name="proxy.user" value="${solenopsis.proxy.user}"/>
<property name="proxy.pass" value="${solenopsis.proxy.pass}"/>
<property name="proxy.host" value="${solenopsis.proxy.host}"/>
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/>
</target>
</project>
</target>
</project>

0 comments on commit 08e9f62

Please sign in to comment.