> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/salesforce-lightning/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.1/integrate-the-salesforce-lightning-app/step-13-manage-permission-sets.md).

# Step 13: Manage permission sets

Learn how to provide permission sets.

## Provide permission sets

To provide permissions for standard objects and fields, run the following script once from the developer console. Note that this class is outside of the package.

{% code title="Permission script" %}

```
PermissionSet pr = new PermissionSet(Label='DRB2B Additional Permission set',Name='DRB2B_Additional_Permission_set');
        insert pr;
        System.debug('pr >'+pr);
        List<ObjectPermissions>  objectPermissionList = new List<ObjectPermissions>();
 
        ObjectPermissions objPermission = new ObjectPermissions();
        objPermission.PermissionsCreate=true;
        objPermission.PermissionsRead=true;
        objPermission.PermissionsEdit=true;
        objPermission.PermissionsDelete=true;
        objPermission.SobjectType='ORDER';
        objPermission.ParentId = pr.Id;
        objectPermissionList.add(objPermission);
 
        objPermission = new ObjectPermissions();
        objPermission.PermissionsCreate=true;
        objPermission.PermissionsRead=true;
        objPermission.PermissionsEdit=true;
        objPermission.PermissionsDelete=true;
        objPermission.SobjectType='Ordersummary';
        objPermission.ParentId = pr.Id;
        objectPermissionList.add(objPermission);
 
        objPermission = new ObjectPermissions();
        objPermission.PermissionsCreate=true;
        objPermission.PermissionsRead=true;
        objPermission.PermissionsEdit=true;
        objPermission.PermissionsDelete=true;
        objPermission.SobjectType='WebStore';
        objPermission.ParentId = pr.Id;
        objectPermissionList.add(objPermission);
 
        objPermission = new ObjectPermissions();
        objPermission.PermissionsCreate=true;
        objPermission.PermissionsRead=true;
        objPermission.PermissionsEdit=true;
        objPermission.PermissionsDelete=true;
        objPermission.SobjectType='WebCart';
        objPermission.ParentId = pr.Id;
        objectPermissionList.add(objPermission);
 
        objPermission = new ObjectPermissions();
        objPermission.PermissionsCreate=true;
        objPermission.PermissionsRead=true;
        objPermission.PermissionsEdit=true;
        objPermission.PermissionsDelete=true;
        objPermission.SobjectType='Product2';
        objPermission.ParentId = pr.Id;
        objectPermissionList.add(objPermission);
 
        objPermission = new ObjectPermissions();
        objPermission.PermissionsRead=true;
        objPermission.SobjectType='Account';
        objPermission.ParentId = pr.Id;
        objectPermissionList.add(objPermission);
 
        insert objectPermissionList;
        List<FieldPermissions> fieldPermissionList = new List<FieldPermissions>();
        //OrderSummary Object fields
        FieldPermissions fp= new FieldPermissions();
        //OrderItem Object fields
        fp.Field='OrderItem.TotalTaxAmount';//the name of new field
        fp.ParentId = pr.Id;
        fp.PermissionsRead=true;
        fp.SobjectType='OrderItem';
        fieldPermissionList.add(fp);
 
        fp= new FieldPermissions();
        fp.Field='Product2.Productcode';//the name of new field
        fp.ParentId = pr.Id;
        fp.PermissionsEdit=true;//
        fp.PermissionsRead=true;
        fp.SobjectType='Product2';
        fieldPermissionList.add(fp);
 
        fp= new FieldPermissions();
        fp.Field='Product2.StockKeepingUnit';//the name of new field
        fp.ParentId = pr.Id;
        fp.PermissionsEdit=true;//
        fp.PermissionsRead=true;
        fp.SobjectType='Product2';
        fieldPermissionList.add(fp);
 
        fp= new FieldPermissions();
        fp.Field='Product2.DisplayUrl';//the name of new field
        fp.ParentId = pr.Id;
        fp.PermissionsEdit=true;//
        fp.PermissionsRead=true;
        fp.SobjectType='Product2';
        fieldPermissionList.add(fp);
 
        fp= new FieldPermissions();
        fp.Field='Product2.QuantityUnitOfMeasure';//the name of new field
        fp.ParentId = pr.Id;
        fp.PermissionsEdit=true;//
        fp.PermissionsRead=true;
        fp.SobjectType='Product2';
        fieldPermissionList.add(fp);
 
        Insert fieldPermissionList;
```

{% endcode %}

## Sharing settings

Ensure that the Sharing Settings for the Order object are set to **Public Read/Write**. If the Order object is set to **Controlled by Parent**, the Sharing Settings for Account and Contract should be **Public Read/Write**.

![](https://2148947133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw4LUVtzRnCnYyAQNDxTM%2Fuploads%2Fgit-blob-cc76f8ebefc3896ca126dc82d792af7bc4a725e7%2FSharingsettings.PNG?alt=media)

## Digital River permission sets

| Permission set                       | Description                                                                                                                          |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| Digital River Connector - Admin      | Assign this permission set to Admin users to access the **Digital River App Configuration** page and to update configurations in it. |
| DigitalRiver Connector - Shopper     | Assign this permission set to all Storefront users.                                                                                  |
| DigitalRiver Connector - Integration | Assign this permission set to the Integration users.                                                                                 |
| DigitalRiver Connector - Refunds     | Assign this permission set to customer service representatives (CSRs) who initiate the refunds.                                      |

## Assign users to a permission set

To assign users to a permission set:

1. Type **Permission Sets** in the **Search** field and press **Enter**.\
   ![](https://2148947133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw4LUVtzRnCnYyAQNDxTM%2Fuploads%2Fgit-blob-b0da632a4b630ee5bbcd6ca9099db359e8ef849b%2FPermission%20set%201.png?alt=media)
2. Click **Permission Sets**. The **Permission Sets** page appears.
3. In the **Permission Set Label** column, click the permission set you want to add users to.\
   ![](https://2148947133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw4LUVtzRnCnYyAQNDxTM%2Fuploads%2Fgit-blob-246df215654c702d6a803b76c74b3b6cdd3e7702%2FPermission%20set%202.png?alt=media)

   This example shows how to assign a **Digital River Connector – Admin** permission set to users. ![](https://2148947133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw4LUVtzRnCnYyAQNDxTM%2Fuploads%2Fgit-blob-b0da632a4b630ee5bbcd6ca9099db359e8ef849b%2FPermission%20set%201.png?alt=media)
4. On the **Permission Set** page, click **Manage Assignments**.\
   ![](https://2148947133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw4LUVtzRnCnYyAQNDxTM%2Fuploads%2Fgit-blob-101b10524bfb83924b419a6d027341d2420d6702%2FPermission%20set%204.png?alt=media)
5. Click **Add Assignments**.\
   ![](https://2148947133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw4LUVtzRnCnYyAQNDxTM%2Fuploads%2Fgit-blob-2b24ae2c9b99f982902d41e747f753f0f087b979%2FPermission%20set%205.png?alt=media)
6. Select one or more users who you want to assign to this permission set and click **Assign**. The assigned users now appear in the modified permission set.\
   ![](https://2148947133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fw4LUVtzRnCnYyAQNDxTM%2Fuploads%2Fgit-blob-7209668e72ba65b27300b2f35fdcbc249d9db94b%2FPermission%20set%206.png?alt=media)

See the [Digital River permission sets table](/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.1/integrate-the-salesforce-lightning-app/step-13-manage-permission-sets.md) to repeat the above-mentioned steps for assigning relevant permission sets.
