Simple tool to quickly manage SFCC users in Account Manager and SFCC instances.
Do you need to provide access to SFCC instances frequently, but don't want to spend much time on AM authentication and clicking through its UI? Do you have non-default SFCC roles that you need to assign to users, but have to wait for their first login to the SFCC instance?
sfcc-users
will do this manual work for you in several seconds, just give it emails of users you need to provide access to.
- Create AM users with defined roles and scopes
- Create SFCC users with non-default roles
- Process list of emails at once
- More features to come!
This tool uses sfcc-ci
and its configuration to interact with SFCC instances (to manage users there).
It looks for valid dw.json
config with fields needed for sfcc-ci
- "client-id", "client-secret", "username", "password". Format is described in sfcc-ci guide
For the very first run, you need to generate configuration file. Run from the root of your project (the same level where dw.json
is):
npx sfcc-users setup
You will be asked a few questions to generate configuration file for future use. You may want to commit the configuration file to let your teammates to skip the setup
step.
You can create/modify generated configuration file manually if you need. Format is described in Configuration file section below.
You can provide emails by simply running the add
command:
npx sfcc-users add
The tool will ask you to enter one or several emails (comma-separated).
You can provide a file with emails (one per line):
You can also specify list of emails or a file as an argument of add
command to skip the first prompt:
npx sfcc-users add test.user@example.com another.user@example.com
# or
npx sfcc-users add users.txt
Configuration file is JavaScript file that is used by sfcc-users
to identify where and how users should be managed.
Format (CommonJS config will be generated instead if you don't use "type": "module"
):
import { createRequire } from 'module';
const DW_PATH = "./dw.json";
const require = createRequire(import.meta.url);
const dw = require(DW_PATH);
const configs = [
{
"orgName": "Northern Trail Outfitters",
"realm": "abcd",
"instances": [
{
"title": "abcd-001.dx.commercecloud.salesforce.com",
"hostname": "abcd-001.dx.commercecloud.salesforce.com",
"shortcode": "abcd_001",
},
{
"title": "You can change title to anything",
"hostname": "abcd-002.dx.commercecloud.salesforce.com",
"shortcode": "abcd_002",
},
{
"title": "UAT instance",
"hostname": "development-us01-nto.demandware.net",
"shortcode": "abcd_dev",
},
{
"title": "Preview environment",
"hostname": "staging-us01-nto.demandware.net",
"shortcode": "abcd_stg",
},
{
"title": "Production",
"hostname": "production-us01-nto.demandware.net",
"shortcode": "abcd_prd",
},
],
// AM roles to select from (only SFCC roles are supported)
"roles": [
"bm-user",
"bm-admin",
],
// Non-default SFCC instance roles that you may have
"instanceRoles": ["Non_Admin"],
},
];
export default configs.map((config) => ({ ...dw, ...config }));