From 08e9f628b9ac20aa202fb1ac19d8e9aa616ec65b Mon Sep 17 00:00:00 2001 From: Patrick Connelly Date: Thu, 13 Feb 2020 17:13:08 -0500 Subject: [PATCH] Adding support for sharing rules (#267) * 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 <58082751+flossy-redhat@users.noreply.github.com> --- ant/1.1/properties/sfdc.metadata.properties | 59 ++++++- ant/1.1/util/sfdc-util.xml | 172 +++++++++++++------- ant/solenopsis.xml | 5 +- 3 files changed, 168 insertions(+), 68 deletions(-) diff --git a/ant/1.1/properties/sfdc.metadata.properties b/ant/1.1/properties/sfdc.metadata.properties index 5162e34..b30bdd4 100644 --- a/ant/1.1/properties/sfdc.metadata.properties +++ b/ant/1.1/properties/sfdc.metadata.properties @@ -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. @@ -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] # @@ -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 @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/ant/1.1/util/sfdc-util.xml b/ant/1.1/util/sfdc-util.xml index 17834e2..6b627d7 100644 --- a/ant/1.1/util/sfdc-util.xml +++ b/ant/1.1/util/sfdc-util.xml @@ -203,7 +203,7 @@ ${sfdc-util.SF-JAR.PATH} - + @@ -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"); @@ -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"); @@ -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"); @@ -524,7 +555,9 @@ ${sfdc-util.SF-JAR.PATH} } void addName(StringBuilder sb, String key) { - sb.append(" ").append(xmlMap.get(key)).append("\n"); + if (null != xmlMap.get(key)) { + sb.append(" ").append(xmlMap.get(key)).append("\n"); + } } void addTypes(StringBuilder sb, String key, TreeSet files) { @@ -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(" \n"); + sb.append(" *\n"); + sb.append(" ").append(wildcard).append("\n"); + sb.append(" \n"); + } + } + void addFields(StringBuilder sb, String fieldList) { if (null == fieldList) { return; @@ -583,6 +629,8 @@ ${sfdc-util.SF-JAR.PATH} addTypes(sb, key, elementMap.get(key)); } + addWildcards(sb, wildcardSet); + addFields(sb, fieldList); sb.append(" ").append(attributes.get("version")).append("\n"); diff --git a/ant/solenopsis.xml b/ant/solenopsis.xml index 802579b..43c7c97 100644 --- a/ant/solenopsis.xml +++ b/ant/solenopsis.xml @@ -26,11 +26,12 @@ + - - + + \ No newline at end of file