Skip to content

Commit

Permalink
Break out Coupons Permissions into separate PermissionSet (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadaismail-stripe authored Dec 23, 2022
1 parent 2f5f7ea commit 3bb0dbf
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 215 deletions.
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,25 @@ Here are some of the 'tags' that PR comments will be prefixed with to provide mo
- `suggestion`
- `issue`

# SalesForce
# Salesforce

## Permission assignments

In order for the ruby service to update Stripe ID fields, it needs to have the right permissions. Here are the two permissions required:

### Required permission sets
In order for the ruby service to update Stripe ID fields, the user needs to have the right permissions. Here are the two permissions required:
- "Stripe Connector Integration User" permission set
- Update Activated Orders

In the org, go to setup>permission sets> stripe connector integration user> manage assignments>add assignments and check your user in the org > then click assign.
In order for users to add coupons to a CPQ quote or quote line, the user will need to have:
- "Stripe Connector Coupon User" permission set

Note: The user can't assign the "Stripe Connector Coupon User" permission set without first having the 'Salesforce CPQ License' permission set license. Otherwise, you'll get an error 'This permission set contains an object that requires a license. Before continuing, assign the user to the related permission set license.' when trying to add the permission set.

### Assigning a permission set
- In the org, go to setup>permission sets> select the permission set (e.g, stripe connector integration user)> manage assignments>add assignments and check your user in the org > then click assign
- It is possible to bulk [assign a permission set license](https://help.salesforce.com/s/articleView?id=000384595&type=1) and/or [assign a permission set](https://help.salesforce.com/s/articleView?id=000383736&type=1in) Salesforce through the UI.


## Clearing Our Test Data

Expand Down Expand Up @@ -312,8 +321,16 @@ https://appiphony92-dev-ed.my.salesforce.com/

## Removing Components from QA or Production Packages

As referenced above, it is a slightly convoluted process to remove a component from a package once it has been added. You must:
As referenced above, it is a slightly convoluted process to remove a component from a package once it has been added. You must either:

Manually delete objects & their dependencies via the Object Manager in the respective QA / Prod org
- If you don't see a 'Del' button, try reverting to 'Salesforce Classic' by selecting 'Profile'->'Switch to Salesforce ClassicSwitch information'
- ** Important** You cannot create a new validation rule, trigger, field with the same name after it's been deleted. In other words, ensure that future changes to these objects will not be made.
- You will have to delete any associated validation rules, triggers, fields in order to delete the custom object
- After deleting the objects, you may still see them referenced in the 'Unused Components' during a package install. These objects are not included in the package though.
- Salesfore case discussing this: https://help.salesforce.com/s/case-view?caseId=500Hx00000AFa8fIAD

Reverting to package to Beta
- Log into the partner community (https://help.salesforce.com/)
- Make sure you select technical support from the options drop down when creating a new case
- Provide them the org ID, package name and version number you would like rolled back to Beta.
Expand Down
2 changes: 1 addition & 1 deletion sfdx/bin/generate-cpq-scratch-org
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ sfdx config:set restDeploy=true apiVersion=54.0
sfdx force:source:push --loglevel=debug -u $salesforceAlias

# needs to be done after the source:push since this references custom perm sets
sfdx force:user:permset:assign -n "Stripe_Connector_Integration_User, Stripe_Connector_Sync_Management_User, Order_Permissions" -u $salesforceAlias
sfdx force:user:permset:assign -n "Stripe_Connector_Integration_User, Stripe_Connector_Sync_Management_User, Stripe_Connector_Coupon_User, Order_Permissions" -u $salesforceAlias

# create global key metadata
if [ ! -z "$SF_MANAGED_PACKAGE_API_KEY" ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Name__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Percent_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Amount_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Duration_In_Months__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Max_Redemptions__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Stripe_ID__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Stripe_Dashboard_Link__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Name__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Percent_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Amount_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Duration_In_Months__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Max_Redemptions__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Stripe_ID__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Stripe_Dashboard_Link__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Order__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Order_Item__c</field>
<readable>true</readable>
</fieldPermissions>
<hasActivationRequired>false</hasActivationRequired>
<label>Stripe Connector Coupon User</label>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowDelete>true</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>Quote_Stripe_Coupon__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowDelete>true</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>Quote_Stripe_Coupon_Association__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowDelete>true</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>Quote_Line_Stripe_Coupon_Association__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowRead>true</allowRead>
<object>Order_Stripe_Coupon__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowRead>true</allowRead>
<object>SBQQ__QuoteLine__c</object>
</objectPermissions>
<objectPermissions>
<allowRead>true</allowRead>
<object>SBQQ__Quote__c</object>
</objectPermissions>
<objectPermissions>
<allowRead>true</allowRead>
<object>Order</object>
</objectPermissions>
</PermissionSet>
Original file line number Diff line number Diff line change
Expand Up @@ -313,81 +313,6 @@
<field>Sync_Record__c.Secondary_Record__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Amount_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Duration_In_Months__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Max_Redemptions__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Name__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Percent_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Stripe_Dashboard_Link__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Quote_Stripe_Coupon__c.Stripe_ID__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Order_Stripe_Coupon__c.Order__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Order_Stripe_Coupon__c.Order_Item__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Order_Stripe_Coupon__c.Stripe_ID__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Order_Stripe_Coupon__c.Stripe_Dashboard_Link__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Amount_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Duration_In_Months__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Max_Redemptions__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Name__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<field>Order_Stripe_Coupon__c.Percent_Off__c</field>
<readable>true</readable>
</fieldPermissions>
<hasActivationRequired>false</hasActivationRequired>
<label>Stripe Connector Integration User</label>
<objectPermissions>
Expand Down Expand Up @@ -417,51 +342,6 @@
<object>Sync_Record__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowDelete>true</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>Quote_Stripe_Coupon__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowDelete>true</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>Quote_Stripe_Coupon_Association__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowDelete>true</allowDelete>
<allowEdit>true</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>true</modifyAllRecords>
<object>Quote_Line_Stripe_Coupon_Association__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<objectPermissions>
<allowRead>true</allowRead>
<object>SBQQ__QuoteLine__c</object>
</objectPermissions>
<objectPermissions>
<allowRead>true</allowRead>
<object>SBQQ__Quote__c</object>
</objectPermissions>
<objectPermissions>
<allowRead>true</allowRead>
<object>Order</object>
</objectPermissions>
<objectPermissions>
<allowCreate>true</allowCreate>
<allowRead>true</allowRead>
<object>Order_Stripe_Coupon__c</object>
<viewAllRecords>true</viewAllRecords>
</objectPermissions>
<pageAccesses>
<apexPage>setup</apexPage>
<enabled>true</enabled>
Expand Down
Loading

0 comments on commit 3bb0dbf

Please sign in to comment.