fluentcart-developer 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +22 -22
- package/LICENSE +21 -21
- package/README.md +169 -127
- package/SKILL.md +127 -127
- package/bin/index.js +281 -281
- package/package.json +48 -37
- package/skills/fluentcart-developer/SKILL.md +172 -172
- package/skills/fluentcart-developer/examples/README.md +25 -25
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
- package/skills/fluentcart-developer/examples/sample-custom-addon/fluentcart-custom-addon.php +114 -114
- package/skills/fluentcart-developer/examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php +149 -149
- package/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
- package/skills/fluentcart-developer/examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php +62 -62
- package/skills/fluentcart-developer/references/action-hooks-admin-templates.md +787 -787
- package/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -1355
- package/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -266
- package/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -855
- package/skills/fluentcart-developer/references/action-hooks-orders.md +631 -631
- package/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -963
- package/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -585
- package/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -661
- package/skills/fluentcart-developer/references/database-models-query-builder.md +194 -194
- package/skills/fluentcart-developer/references/database-models-reference.md +604 -604
- package/skills/fluentcart-developer/references/database-schema-reference.md +940 -940
- package/skills/fluentcart-developer/references/engineering-notes.md +154 -154
- package/skills/fluentcart-developer/references/fee-system-guide.md +449 -449
- package/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -1202
- package/skills/fluentcart-developer/references/filter-hooks-customers-subscriptions.md +902 -902
- package/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -1598
- package/skills/fluentcart-developer/references/filter-hooks-orders-payments.md +1319 -1319
- package/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -628
- package/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -1177
- package/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -154
- package/skills/fluentcart-developer/references/ghost-product-selling.md +458 -458
- package/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -224
- package/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -761
- package/skills/fluentcart-developer/references/rest-api-checkout.md +286 -286
- package/skills/fluentcart-developer/references/rest-api-coupons.md +794 -794
- package/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -190
- package/skills/fluentcart-developer/references/rest-api-customers.md +1121 -1121
- package/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -219
- package/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -619
- package/skills/fluentcart-developer/references/rest-api-files.md +290 -290
- package/skills/fluentcart-developer/references/rest-api-integrations.md +324 -324
- package/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -321
- package/skills/fluentcart-developer/references/rest-api-licensing.md +171 -171
- package/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -200
- package/skills/fluentcart-developer/references/rest-api-orders.md +1241 -1241
- package/skills/fluentcart-developer/references/rest-api-overview.md +131 -131
- package/skills/fluentcart-developer/references/rest-api-products.md +2563 -2563
- package/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -172
- package/skills/fluentcart-developer/references/rest-api-reference.md +552 -552
- package/skills/fluentcart-developer/references/rest-api-reports.md +377 -377
- package/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -147
- package/skills/fluentcart-developer/references/rest-api-settings.md +528 -528
- package/skills/fluentcart-developer/references/rest-api-shipping.md +799 -799
- package/skills/fluentcart-developer/references/rest-api-subscriptions.md +606 -606
- package/skills/fluentcart-developer/references/rest-api-tax.md +356 -356
- package/skills/fluentcart-developer/references/subscription-customization.md +197 -197
- package/skills/fluentcart-developer/scripts/cli.js +1 -1
- package/.gitattributes +0 -2
- package/CONTRIBUTING.md +0 -73
- package/copy-skills.js +0 -43
- package/skills.sh.json +0 -13
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
# Roles & Permissions API (Pro)
|
|
2
|
-
|
|
3
|
-
Manage custom store roles (`super_admin`, `manager`, `worker`, `accountant`), assign capabilities to WordPress users, search eligible users, and inspect role permission matrices in FluentCart Pro.
|
|
4
|
-
|
|
5
|
-
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2/roles`
|
|
6
|
-
**Policy:** `AdminPolicy` (Requires WordPress `manage_options` / `is_super_admin` capability)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Endpoints Overview
|
|
11
|
-
|
|
12
|
-
| Method | Endpoint | Description |
|
|
13
|
-
|--------|----------|-------------|
|
|
14
|
-
| GET | `/roles/managers` | List all WordPress users assigned a FluentCart shop role |
|
|
15
|
-
| GET | `/roles/user-list` | Search WordPress users eligible for role assignment (excludes WP admins) |
|
|
16
|
-
| GET | `/roles` | List available FluentCart role definitions (titles & descriptions) |
|
|
17
|
-
| POST | `/roles` | Assign a shop role to a WordPress user (grants `fluent_cart_admin` capability) |
|
|
18
|
-
| GET | `/roles/{key}` | Placeholder: Get role details |
|
|
19
|
-
| POST | `/roles/{key}` | Placeholder: Update role definition |
|
|
20
|
-
| DELETE | `/roles/{key}` | Remove a shop role assignment from a user (removes `fluent_cart_admin`) |
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 1. List & Search Users
|
|
25
|
-
|
|
26
|
-
### List Managers
|
|
27
|
-
|
|
28
|
-
`GET /fluent-cart/v2/roles/managers`
|
|
29
|
-
|
|
30
|
-
Retrieve all WordPress users who have been assigned a shop role along with their permissions array.
|
|
31
|
-
|
|
32
|
-
#### Response
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"managers": [
|
|
37
|
-
{
|
|
38
|
-
"id": 5,
|
|
39
|
-
"email": "manager@example.com",
|
|
40
|
-
"display_name": "Jane Manager",
|
|
41
|
-
"username": "janemanager",
|
|
42
|
-
"shop_role": "manager",
|
|
43
|
-
"description": "With All Permissions Except Sensitive Settings",
|
|
44
|
-
"registered_at": "2025-03-10 08:00:00",
|
|
45
|
-
"role_permissions": [
|
|
46
|
-
"store/settings",
|
|
47
|
-
"products/view",
|
|
48
|
-
"orders/view",
|
|
49
|
-
"orders/manage",
|
|
50
|
-
"reports/view"
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
### Search Eligible Users
|
|
60
|
-
|
|
61
|
-
`GET /fluent-cart/v2/roles/user-list`
|
|
62
|
-
|
|
63
|
-
Search for WordPress users who can be assigned a shop role.
|
|
64
|
-
|
|
65
|
-
> **Exclusion Rule:** WordPress site Administrators (`manage_options`) are automatically excluded from search results since they already possess full store capabilities.
|
|
66
|
-
|
|
67
|
-
#### Parameters
|
|
68
|
-
|
|
69
|
-
| Parameter | Type | Location | Required | Description |
|
|
70
|
-
|-----------|------|----------|----------|-------------|
|
|
71
|
-
| `search` | string | query | No | Partial search by display name or email address |
|
|
72
|
-
| `user_ids` | string/array | query | No | Include specific user IDs regardless of search term |
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## 2. Role Assignments & Definitions
|
|
77
|
-
|
|
78
|
-
### List Roles
|
|
79
|
-
|
|
80
|
-
`GET /fluent-cart/v2/roles`
|
|
81
|
-
|
|
82
|
-
Retrieve built-in role titles and descriptions (`super_admin`, `manager`, `worker`, `accountant`).
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
### Assign Role
|
|
87
|
-
|
|
88
|
-
`POST /fluent-cart/v2/roles`
|
|
89
|
-
|
|
90
|
-
Assigns a role to a user. The user is granted the `fluent_cart_admin` capability and the role key is stored in user meta.
|
|
91
|
-
|
|
92
|
-
#### Parameters
|
|
93
|
-
|
|
94
|
-
| Parameter | Type | Required | Description |
|
|
95
|
-
|-----------|------|----------|-------------|
|
|
96
|
-
| `user_id` | integer | Yes | WordPress user ID |
|
|
97
|
-
| `role_key` | string | Yes | Role slug (`super_admin`, `manager`, `worker`, `accountant`) |
|
|
98
|
-
|
|
99
|
-
#### Response
|
|
100
|
-
|
|
101
|
-
```json
|
|
102
|
-
{
|
|
103
|
-
"message": "Role synced successfully",
|
|
104
|
-
"is_updated": true
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
### Delete Role Assignment
|
|
111
|
-
|
|
112
|
-
`DELETE /fluent-cart/v2/roles/{key}`
|
|
113
|
-
|
|
114
|
-
Removes the shop role from the specified user and strips the `fluent_cart_admin` capability.
|
|
115
|
-
|
|
116
|
-
#### Parameters
|
|
117
|
-
|
|
118
|
-
| Parameter | Type | Required | Description |
|
|
119
|
-
|-----------|------|----------|-------------|
|
|
120
|
-
| `key` | string | Yes (Path) | Role key being removed |
|
|
121
|
-
| `user_id` | integer | Yes (Body/Query) | WordPress user ID |
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## 3. Built-In Role Definitions & Capability Matrix
|
|
126
|
-
|
|
127
|
-
| Role | Key Permissions Included | Key Restrictions |
|
|
128
|
-
|------|--------------------------|------------------|
|
|
129
|
-
| **Super Admin** | `store/settings`, `store/sensitive`, `products/*`, `customers/*`, `orders/*`, `subscriptions/*`, `licenses/*`, `coupons/*`, `reports/*`, `integrations/*`, `labels/*`, `dashboard_stats/view` | None (Full Access) |
|
|
130
|
-
| **Manager** | All Super Admin permissions except sensitive store settings | Excludes `store/sensitive` |
|
|
131
|
-
| **Worker** | View access for products, customers, orders, subscriptions, licenses, integrations; manage order statuses; view & manage coupons | No product/customer editing, no report access |
|
|
132
|
-
| **Accountant** | View access for products, customers, orders, subscriptions, licenses, coupons, integrations; view & export orders and reports | Read-only with export rights; no management actions |
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## Hooks & Extension Filters
|
|
137
|
-
|
|
138
|
-
```php
|
|
139
|
-
// Extend or customize available role definitions
|
|
140
|
-
add_filter('fluent_cart/permission/all_roles', function($roles) {
|
|
141
|
-
$roles['fulfillment_agent'] = [
|
|
142
|
-
'title' => 'Fulfillment Agent',
|
|
143
|
-
'description' => 'Manage orders and shipping statuses only'
|
|
144
|
-
];
|
|
145
|
-
return $roles;
|
|
146
|
-
});
|
|
147
|
-
```
|
|
1
|
+
# Roles & Permissions API (Pro)
|
|
2
|
+
|
|
3
|
+
Manage custom store roles (`super_admin`, `manager`, `worker`, `accountant`), assign capabilities to WordPress users, search eligible users, and inspect role permission matrices in FluentCart Pro.
|
|
4
|
+
|
|
5
|
+
**Base URL:** `https://your-site.com/wp-json/fluent-cart/v2/roles`
|
|
6
|
+
**Policy:** `AdminPolicy` (Requires WordPress `manage_options` / `is_super_admin` capability)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Endpoints Overview
|
|
11
|
+
|
|
12
|
+
| Method | Endpoint | Description |
|
|
13
|
+
|--------|----------|-------------|
|
|
14
|
+
| GET | `/roles/managers` | List all WordPress users assigned a FluentCart shop role |
|
|
15
|
+
| GET | `/roles/user-list` | Search WordPress users eligible for role assignment (excludes WP admins) |
|
|
16
|
+
| GET | `/roles` | List available FluentCart role definitions (titles & descriptions) |
|
|
17
|
+
| POST | `/roles` | Assign a shop role to a WordPress user (grants `fluent_cart_admin` capability) |
|
|
18
|
+
| GET | `/roles/{key}` | Placeholder: Get role details |
|
|
19
|
+
| POST | `/roles/{key}` | Placeholder: Update role definition |
|
|
20
|
+
| DELETE | `/roles/{key}` | Remove a shop role assignment from a user (removes `fluent_cart_admin`) |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. List & Search Users
|
|
25
|
+
|
|
26
|
+
### List Managers
|
|
27
|
+
|
|
28
|
+
`GET /fluent-cart/v2/roles/managers`
|
|
29
|
+
|
|
30
|
+
Retrieve all WordPress users who have been assigned a shop role along with their permissions array.
|
|
31
|
+
|
|
32
|
+
#### Response
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"managers": [
|
|
37
|
+
{
|
|
38
|
+
"id": 5,
|
|
39
|
+
"email": "manager@example.com",
|
|
40
|
+
"display_name": "Jane Manager",
|
|
41
|
+
"username": "janemanager",
|
|
42
|
+
"shop_role": "manager",
|
|
43
|
+
"description": "With All Permissions Except Sensitive Settings",
|
|
44
|
+
"registered_at": "2025-03-10 08:00:00",
|
|
45
|
+
"role_permissions": [
|
|
46
|
+
"store/settings",
|
|
47
|
+
"products/view",
|
|
48
|
+
"orders/view",
|
|
49
|
+
"orders/manage",
|
|
50
|
+
"reports/view"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### Search Eligible Users
|
|
60
|
+
|
|
61
|
+
`GET /fluent-cart/v2/roles/user-list`
|
|
62
|
+
|
|
63
|
+
Search for WordPress users who can be assigned a shop role.
|
|
64
|
+
|
|
65
|
+
> **Exclusion Rule:** WordPress site Administrators (`manage_options`) are automatically excluded from search results since they already possess full store capabilities.
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
| Parameter | Type | Location | Required | Description |
|
|
70
|
+
|-----------|------|----------|----------|-------------|
|
|
71
|
+
| `search` | string | query | No | Partial search by display name or email address |
|
|
72
|
+
| `user_ids` | string/array | query | No | Include specific user IDs regardless of search term |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 2. Role Assignments & Definitions
|
|
77
|
+
|
|
78
|
+
### List Roles
|
|
79
|
+
|
|
80
|
+
`GET /fluent-cart/v2/roles`
|
|
81
|
+
|
|
82
|
+
Retrieve built-in role titles and descriptions (`super_admin`, `manager`, `worker`, `accountant`).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### Assign Role
|
|
87
|
+
|
|
88
|
+
`POST /fluent-cart/v2/roles`
|
|
89
|
+
|
|
90
|
+
Assigns a role to a user. The user is granted the `fluent_cart_admin` capability and the role key is stored in user meta.
|
|
91
|
+
|
|
92
|
+
#### Parameters
|
|
93
|
+
|
|
94
|
+
| Parameter | Type | Required | Description |
|
|
95
|
+
|-----------|------|----------|-------------|
|
|
96
|
+
| `user_id` | integer | Yes | WordPress user ID |
|
|
97
|
+
| `role_key` | string | Yes | Role slug (`super_admin`, `manager`, `worker`, `accountant`) |
|
|
98
|
+
|
|
99
|
+
#### Response
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"message": "Role synced successfully",
|
|
104
|
+
"is_updated": true
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### Delete Role Assignment
|
|
111
|
+
|
|
112
|
+
`DELETE /fluent-cart/v2/roles/{key}`
|
|
113
|
+
|
|
114
|
+
Removes the shop role from the specified user and strips the `fluent_cart_admin` capability.
|
|
115
|
+
|
|
116
|
+
#### Parameters
|
|
117
|
+
|
|
118
|
+
| Parameter | Type | Required | Description |
|
|
119
|
+
|-----------|------|----------|-------------|
|
|
120
|
+
| `key` | string | Yes (Path) | Role key being removed |
|
|
121
|
+
| `user_id` | integer | Yes (Body/Query) | WordPress user ID |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 3. Built-In Role Definitions & Capability Matrix
|
|
126
|
+
|
|
127
|
+
| Role | Key Permissions Included | Key Restrictions |
|
|
128
|
+
|------|--------------------------|------------------|
|
|
129
|
+
| **Super Admin** | `store/settings`, `store/sensitive`, `products/*`, `customers/*`, `orders/*`, `subscriptions/*`, `licenses/*`, `coupons/*`, `reports/*`, `integrations/*`, `labels/*`, `dashboard_stats/view` | None (Full Access) |
|
|
130
|
+
| **Manager** | All Super Admin permissions except sensitive store settings | Excludes `store/sensitive` |
|
|
131
|
+
| **Worker** | View access for products, customers, orders, subscriptions, licenses, integrations; manage order statuses; view & manage coupons | No product/customer editing, no report access |
|
|
132
|
+
| **Accountant** | View access for products, customers, orders, subscriptions, licenses, coupons, integrations; view & export orders and reports | Read-only with export rights; no management actions |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Hooks & Extension Filters
|
|
137
|
+
|
|
138
|
+
```php
|
|
139
|
+
// Extend or customize available role definitions
|
|
140
|
+
add_filter('fluent_cart/permission/all_roles', function($roles) {
|
|
141
|
+
$roles['fulfillment_agent'] = [
|
|
142
|
+
'title' => 'Fulfillment Agent',
|
|
143
|
+
'description' => 'Manage orders and shipping statuses only'
|
|
144
|
+
];
|
|
145
|
+
return $roles;
|
|
146
|
+
});
|
|
147
|
+
```
|