identity-admin 1.28.28 → 1.28.29
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/README.md +148 -148
- package/lib/Dashboard.d.ts +14 -14
- package/lib/Dashboard.js +95 -95
- package/lib/container/helpers/HelperInversify.d.ts +6 -6
- package/lib/container/helpers/HelperInversify.js +10 -10
- package/lib/container/helpers/HelperTypes.d.ts +5 -5
- package/lib/container/helpers/HelperTypes.js +7 -7
- package/lib/container/index.d.ts +1 -1
- package/lib/container/index.js +14 -14
- package/lib/container/repositories/RepositoryInversify.d.ts +4 -4
- package/lib/container/repositories/RepositoryInversify.js +13 -13
- package/lib/container/repositories/RepositoryTypes.d.ts +4 -4
- package/lib/container/repositories/RepositoryTypes.js +6 -6
- package/lib/container/types.d.ts +8 -8
- package/lib/container/types.js +9 -9
- package/lib/controllers/ActionController.d.ts +9 -9
- package/lib/controllers/ActionController.js +141 -141
- package/lib/controllers/AdminNotificationController.d.ts +8 -8
- package/lib/controllers/AdminNotificationController.js +69 -69
- package/lib/controllers/DashboardController.d.ts +45 -45
- package/lib/controllers/DashboardController.js +827 -827
- package/lib/controllers/PermissionController.d.ts +6 -6
- package/lib/controllers/PermissionController.js +52 -52
- package/lib/controllers/ResourceController.d.ts +15 -15
- package/lib/controllers/ResourceController.js +128 -128
- package/lib/helpers/ActionsGenerator.d.ts +11 -11
- package/lib/helpers/ActionsGenerator.js +168 -168
- package/lib/helpers/AdminNotifications/AdminNotificationCreation.d.ts +54 -54
- package/lib/helpers/AdminNotifications/AdminNotificationCreation.js +66 -66
- package/lib/helpers/AdminNotifications/AdminNotificationFetcher.d.ts +63 -63
- package/lib/helpers/AdminNotifications/AdminNotificationFetcher.js +45 -45
- package/lib/helpers/FilterQueryHelper.d.ts +9 -9
- package/lib/helpers/FilterQueryHelper.js +83 -83
- package/lib/helpers/FiltersHelper.d.ts +9 -9
- package/lib/helpers/FiltersHelper.js +126 -126
- package/lib/helpers/JsonRichText/DraftRawToUniversalConverter.d.ts +3 -3
- package/lib/helpers/JsonRichText/DraftRawToUniversalConverter.js +144 -144
- package/lib/helpers/JsonRichText/IDraftRawType.d.ts +18 -18
- package/lib/helpers/JsonRichText/IDraftRawType.js +2 -2
- package/lib/helpers/JsonRichText/IUniversalJsonType.d.ts +24 -24
- package/lib/helpers/JsonRichText/IUniversalJsonType.js +10 -10
- package/lib/helpers/LocalesHelper.d.ts +4 -4
- package/lib/helpers/LocalesHelper.js +73 -73
- package/lib/helpers/LocalizedStringHelper.d.ts +11 -11
- package/lib/helpers/LocalizedStringHelper.js +76 -76
- package/lib/helpers/Permissions/PermissionFetcher.d.ts +8 -8
- package/lib/helpers/Permissions/PermissionFetcher.js +95 -95
- package/lib/helpers/Permissions/PermissionLabel.d.ts +2 -2
- package/lib/helpers/Permissions/PermissionLabel.js +42 -42
- package/lib/helpers/Permissions/PermissionMapper.d.ts +13 -13
- package/lib/helpers/Permissions/PermissionMapper.js +35 -35
- package/lib/helpers/Permissions/PermissionResource.d.ts +6 -6
- package/lib/helpers/Permissions/PermissionResource.js +62 -62
- package/lib/helpers/Permissions/PermissionSavingService.d.ts +13 -13
- package/lib/helpers/Permissions/PermissionSavingService.js +32 -32
- package/lib/helpers/Permissions/SavePermissionGroup.d.ts +6 -6
- package/lib/helpers/Permissions/SavePermissionGroup.js +32 -32
- package/lib/helpers/Permissions/UpdatePermissionGroup.d.ts +6 -6
- package/lib/helpers/Permissions/UpdatePermissionGroup.js +50 -50
- package/lib/helpers/Permissions/types.d.ts +17 -17
- package/lib/helpers/Permissions/types.js +2 -2
- package/lib/helpers/PopulationHelper.d.ts +12 -12
- package/lib/helpers/PopulationHelper.js +50 -50
- package/lib/helpers/RecordsCounter.d.ts +10 -10
- package/lib/helpers/RecordsCounter.js +33 -33
- package/lib/helpers/ReportsGenerator.d.ts +26 -26
- package/lib/helpers/ReportsGenerator.js +162 -162
- package/lib/helpers/ResourceGenerator.d.ts +9 -9
- package/lib/helpers/ResourceGenerator.js +172 -172
- package/lib/helpers/ResourceHelper.d.ts +28 -28
- package/lib/helpers/ResourceHelper.js +397 -397
- package/lib/helpers/RportsGenerator.d.ts +10 -10
- package/lib/helpers/RportsGenerator.js +21 -21
- package/lib/helpers/SchemaGenerator.d.ts +7 -7
- package/lib/helpers/SchemaGenerator.js +137 -137
- package/lib/helpers/SchemaHelper.d.ts +5 -5
- package/lib/helpers/SchemaHelper.js +21 -21
- package/lib/helpers/UserActionsLog/UserActionsLogHelper.d.ts +2 -2
- package/lib/helpers/UserActionsLog/UserActionsLogHelper.js +49 -49
- package/lib/locales/en.json +54 -54
- package/lib/middlewares/cache/decorator.d.ts +3 -3
- package/lib/middlewares/cache/decorator.js +60 -60
- package/lib/middlewares/cache/deletionMethods.d.ts +3 -3
- package/lib/middlewares/cache/deletionMethods.js +23 -23
- package/lib/middlewares/isAuth.d.ts +13 -13
- package/lib/middlewares/isAuth.js +43 -43
- package/lib/models/ModelNames.d.ts +10 -10
- package/lib/models/ModelNames.js +13 -13
- package/lib/models/adminNotification/AdminNotification.d.ts +5 -5
- package/lib/models/adminNotification/AdminNotification.js +70 -70
- package/lib/models/adminNotification/IAdminNotification.d.ts +35 -35
- package/lib/models/adminNotification/IAdminNotification.js +15 -15
- package/lib/models/adminpermission/AdminPermission.d.ts +6 -6
- package/lib/models/adminpermission/AdminPermission.js +27 -27
- package/lib/models/adminpermission/IAdminPermission.d.ts +13 -13
- package/lib/models/adminpermission/IAdminPermission.js +2 -2
- package/lib/models/customPage/CustomPage.d.ts +2 -2
- package/lib/models/customPage/CustomPage.js +38 -38
- package/lib/models/customPage/ICustomPage.d.ts +17 -17
- package/lib/models/customPage/ICustomPage.js +2 -2
- package/lib/models/file/File.d.ts +2 -2
- package/lib/models/file/File.js +23 -23
- package/lib/models/file/IFile.d.ts +15 -15
- package/lib/models/file/IFile.js +2 -2
- package/lib/models/language/ILanguage.d.ts +8 -8
- package/lib/models/language/ILanguage.js +8 -8
- package/lib/models/language/LanguageSchema.d.ts +9 -9
- package/lib/models/language/LanguageSchema.js +17 -17
- package/lib/models/location/ILocation.d.ts +16 -16
- package/lib/models/location/ILocation.js +2 -2
- package/lib/models/location/Location.d.ts +2 -2
- package/lib/models/location/Location.js +29 -29
- package/lib/models/mailLog/IMailLog.d.ts +14 -14
- package/lib/models/mailLog/IMailLog.js +2 -2
- package/lib/models/mailLog/MailLog.d.ts +3 -3
- package/lib/models/mailLog/MailLog.js +23 -23
- package/lib/models/modelConfiguration/IModelConfigurations.d.ts +31 -31
- package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
- package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
- package/lib/models/modelConfiguration/ModelConfiguration.js +103 -103
- package/lib/models/permission/IPermission.d.ts +14 -14
- package/lib/models/permission/IPermission.js +2 -2
- package/lib/models/permission/Permission.d.ts +6 -6
- package/lib/models/permission/Permission.js +28 -28
- package/lib/models/permissiongroup/IPermissionGroup.d.ts +15 -15
- package/lib/models/permissiongroup/IPermissionGroup.js +2 -2
- package/lib/models/permissiongroup/PermissionGroup.d.ts +6 -6
- package/lib/models/permissiongroup/PermissionGroup.js +23 -23
- package/lib/models/request-log/IRequestLog.d.ts +22 -22
- package/lib/models/request-log/IRequestLog.js +2 -2
- package/lib/models/request-log/RequestLog.d.ts +3 -3
- package/lib/models/request-log/RequestLog.js +51 -51
- package/lib/models/userActionsLog/IUserActionsLog.d.ts +26 -26
- package/lib/models/userActionsLog/IUserActionsLog.js +11 -11
- package/lib/models/userActionsLog/UserActionsLog.d.ts +3 -3
- package/lib/models/userActionsLog/UserActionsLog.js +41 -41
- package/lib/pdf/ReportTemplate.d.ts +71 -71
- package/lib/pdf/ReportTemplate.js +94 -94
- package/lib/repositories/AdminNotificationRepository.d.ts +7 -7
- package/lib/repositories/AdminNotificationRepository.js +23 -23
- package/lib/repositories/AdminPermissionRepository.d.ts +7 -7
- package/lib/repositories/AdminPermissionRepository.js +23 -23
- package/lib/repositories/DashboardRepository.d.ts +5 -5
- package/lib/repositories/DashboardRepository.js +12 -12
- package/lib/repositories/PermissionGroupRepository.d.ts +7 -7
- package/lib/repositories/PermissionGroupRepository.js +23 -23
- package/lib/repositories/PermissionRepository.d.ts +7 -7
- package/lib/repositories/PermissionRepository.js +23 -23
- package/lib/repositories/Repository.d.ts +68 -68
- package/lib/repositories/Repository.js +215 -215
- package/lib/repositories/RequestLogRepository.d.ts +10 -10
- package/lib/repositories/RequestLogRepository.js +54 -54
- package/lib/repositories/SaveResult.d.ts +14 -14
- package/lib/repositories/SaveResult.js +18 -18
- package/lib/resources/AdminNotificationsResource.d.ts +3 -3
- package/lib/resources/AdminNotificationsResource.js +23 -23
- package/lib/resources/AdminPermissionResource.d.ts +5 -5
- package/lib/resources/AdminPermissionResource.js +36 -36
- package/lib/resources/PermissionGroupResource.d.ts +5 -5
- package/lib/resources/PermissionGroupResource.js +60 -60
- package/lib/resources/PermissionsResource.d.ts +5 -5
- package/lib/resources/PermissionsResource.js +23 -23
- package/lib/resources/parents.d.ts +12 -12
- package/lib/resources/parents.js +15 -15
- package/lib/router/index.d.ts +8 -8
- package/lib/router/index.js +104 -104
- package/lib/seeds/PermissionSeeder.d.ts +4 -4
- package/lib/seeds/PermissionSeeder.js +56 -56
- package/lib/types/DashbordConfig.d.ts +21 -21
- package/lib/types/DashbordConfig.js +2 -2
- package/lib/types/IConfigurationFile.d.ts +14 -14
- package/lib/types/IConfigurationFile.js +2 -2
- package/lib/types/IResourceFile.d.ts +738 -736
- package/lib/types/IResourceFile.js +2 -2
- package/lib/types/IResourceResponse.d.ts +96 -96
- package/lib/types/IResourceResponse.js +2 -2
- package/lib/types/helpers.d.ts +71 -71
- package/lib/types/helpers.js +83 -83
- package/lib/utils/DateUtils.d.ts +7 -7
- package/lib/utils/DateUtils.js +45 -45
- package/lib/utils/ResourceUtils.d.ts +2 -2
- package/lib/utils/ResourceUtils.js +7 -7
- package/lib/utils/ResponseUtils.d.ts +11 -11
- package/lib/utils/ResponseUtils.js +41 -41
- package/lib/utils/StringUtils.d.ts +9 -9
- package/lib/utils/StringUtils.js +46 -46
- package/lib/view/asset-manifest.json +18 -18
- package/lib/view/assets/icons/delete_icon.svg +3 -3
- package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
- package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
- package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
- package/lib/view/assets/icons/info_icon.svg +3 -3
- package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
- package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
- package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
- package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
- package/lib/view/assets/icons/small_info_icon.svg +3 -3
- package/lib/view/assets/illustrations/Group 16.svg +4 -4
- package/lib/view/assets/illustrations/logo.svg +5 -5
- package/lib/view/favicon/browserconfig.xml +9 -9
- package/lib/view/favicon/safari-pinned-tab.svg +182 -182
- package/lib/view/favicon/site.webmanifest +19 -19
- package/lib/view/fonts/index.css +18 -18
- package/lib/view/index.html +52 -52
- package/lib/view/manifest.json +20 -20
- package/lib/view/robots.txt +3 -3
- package/lib/view/static/css/main.54de06ef.css +1 -1
- package/lib/view/static/js/574.778b5963.chunk.js +1 -1
- package/lib/view/static/js/678.521704a3.chunk.js +1 -1
- package/lib/view/static/js/798.54856416.chunk.js +1 -1
- package/lib/view/static/js/main.4687f255.js +2 -2
- package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
- package/package.json +65 -64
- package/skills/identity-admin/SKILL.md +272 -0
- package/skills/identity-admin/resource-file.md +654 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: identity-admin
|
|
3
|
+
description: Use when setting up or configuring the identity-admin dashboard, creating or editing resource files, troubleshooting admin dashboard behavior, or integrating identity-admin plugins
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<SUBAGENT-STOP>
|
|
7
|
+
If you were dispatched as a subagent to execute a specific task, skip this skill.
|
|
8
|
+
</SUBAGENT-STOP>
|
|
9
|
+
|
|
10
|
+
# identity-admin
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
`identity-admin` is an Express + Mongoose package that auto-generates a full admin dashboard (REST API + React Material UI frontend) from simple resource file definitions. You define the models and field configurations, and the dashboard handles CRUD, filters, permissions, notifications, reports, and imports.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- Installing `identity-admin` in a new or existing Express + Mongoose project
|
|
19
|
+
- Creating or editing **resource files** (`IResourceFile`) that describe how a Mongoose model appears in the dashboard
|
|
20
|
+
- Configuring dashboard authentication (session-based with cookies)
|
|
21
|
+
- Adding custom CRUD hooks (before/after handlers)
|
|
22
|
+
- Defining custom actions, filter scopes, or field overrides
|
|
23
|
+
- Setting up the permissions plugin or admin notifications plugin
|
|
24
|
+
- Troubleshooting missing resources, auth failures, or incorrect field display
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm i identity-admin
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Requires `mongoose`, `express`, and `inversify` (with `inversify-express-utils`) in your project.
|
|
33
|
+
|
|
34
|
+
## Quick Start — Unauthenticated Dashboard
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import Dashboard from 'identity-admin';
|
|
38
|
+
import { IResourceFile } from 'identity-admin/lib/types/IResourceFile';
|
|
39
|
+
import MyModel from './models/MyModel';
|
|
40
|
+
|
|
41
|
+
const myResource: IResourceFile = {
|
|
42
|
+
properties: {
|
|
43
|
+
resource: MyModel,
|
|
44
|
+
modelName: 'mymodel',
|
|
45
|
+
name: 'My Model',
|
|
46
|
+
title: 'name',
|
|
47
|
+
},
|
|
48
|
+
listProperties: ['name', 'createdAt'],
|
|
49
|
+
formProperties: ['name', 'description'],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const dashboard = new Dashboard({ resources: [myResource] });
|
|
53
|
+
|
|
54
|
+
// After mongoose.connect(...)
|
|
55
|
+
dashboard.build(app);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The dashboard is now available at `/dashboard`.
|
|
59
|
+
|
|
60
|
+
## Dashboard Configuration (`DashboardConfig`)
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
interface DashboardConfig {
|
|
64
|
+
resources: IResourceFile[]; // required — array of resource definitions
|
|
65
|
+
rootPath?: string; // default "/dashboard"
|
|
66
|
+
configurations?: IConfiguartionFile;
|
|
67
|
+
localesOptions?: i18n.ConfigurationOptions;
|
|
68
|
+
cookiesConfiguration?: CookieConfiguration;
|
|
69
|
+
authenticate?: AuthenticateMiddleWare;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Resource Files — Quick Reference
|
|
74
|
+
|
|
75
|
+
A resource file (`IResourceFile`) tells the dashboard how to handle a Mongoose model. The two required properties are:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
properties: {
|
|
79
|
+
resource: Model<any, any>; // the Mongoose model
|
|
80
|
+
modelName: string; // collection name in the database
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Common optional properties:
|
|
85
|
+
|
|
86
|
+
| Property | Purpose |
|
|
87
|
+
|----------|---------|
|
|
88
|
+
| `properties.name` | Display name in the nav bar (defaults to `modelName`) |
|
|
89
|
+
| `properties.title` | Field used as the record link and search target (defaults to `name`, `title`, or `email`; falls back to `_id`) |
|
|
90
|
+
| `properties.parent` | Nav group: `{ name: string, icon: string }` (MUI icon names) |
|
|
91
|
+
| `properties.isAllowed` | `(currentUser) => boolean` — permission gate |
|
|
92
|
+
| `properties.isVisible` | `(currentUser) => boolean` — nav bar visibility |
|
|
93
|
+
| `properties.hiddenProperties` | Array of field names to hide entirely |
|
|
94
|
+
| `properties.defaultOrderBy` / `defaultOrder` | Sort field and direction |
|
|
95
|
+
| `properties.defaultrowsPerPage` | Pagination size (default 10) |
|
|
96
|
+
|
|
97
|
+
**Display arrays** control which fields appear on each page:
|
|
98
|
+
|
|
99
|
+
- `listProperties` — table columns in the list view
|
|
100
|
+
- `showProperties` — read-only detail view
|
|
101
|
+
- `formProperties` — create/edit form fields
|
|
102
|
+
- `filterProperties` — advanced filter fields
|
|
103
|
+
- `quickFilterProperties` — quick filter chips
|
|
104
|
+
|
|
105
|
+
> **For the complete resource file interface reference — all field overrides, virtuals, actions, filters, CRUD hooks, population, and localization options — read `resource-file.md`.**
|
|
106
|
+
|
|
107
|
+
## Authenticated Dashboard
|
|
108
|
+
|
|
109
|
+
Add session-based authentication with cookies:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
const dashboard = new Dashboard({
|
|
113
|
+
resources: [myResource],
|
|
114
|
+
cookiesConfiguration: {
|
|
115
|
+
cookiesSecret: "your-secret",
|
|
116
|
+
cookieName: "connect.sid"
|
|
117
|
+
},
|
|
118
|
+
authenticate: async (credentials: AdminCredentials) => {
|
|
119
|
+
const user = await Admin.findOne({ email: credentials.email });
|
|
120
|
+
if (user) {
|
|
121
|
+
const matched = await bcrypt.compare(credentials.password, user.encryptedPassword);
|
|
122
|
+
if (matched) return user;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## App Configuration (`IConfiguartionFile`)
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
interface IConfiguartionFile {
|
|
133
|
+
textFieldSize?: 'small' | 'medium';
|
|
134
|
+
defaultRowsPerPage?: number;
|
|
135
|
+
themeLayout?: 'mini' | 'vertical' | 'horizontal';
|
|
136
|
+
themeStretch?: boolean;
|
|
137
|
+
showMainActions?: boolean;
|
|
138
|
+
adminNotifications?: boolean;
|
|
139
|
+
baseApiUrl?: string;
|
|
140
|
+
enableLocalization?: boolean;
|
|
141
|
+
disableDuplicateAction?: boolean;
|
|
142
|
+
enablePermissions?: boolean;
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Pass it via `configurations` in `DashboardConfig`.
|
|
147
|
+
|
|
148
|
+
## Custom Actions
|
|
149
|
+
|
|
150
|
+
Add extra record or resource actions:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
actions: {
|
|
154
|
+
extras: [{
|
|
155
|
+
key: 'approve',
|
|
156
|
+
name: 'Approve',
|
|
157
|
+
icon: 'CheckCircle',
|
|
158
|
+
actionType: 'record', // 'record' | 'resource'
|
|
159
|
+
handler: async (req, res, data) => {
|
|
160
|
+
data.record.status = 'approved';
|
|
161
|
+
await data.record.save();
|
|
162
|
+
return { action: 'LIST', path: data.resource.path };
|
|
163
|
+
},
|
|
164
|
+
}],
|
|
165
|
+
},
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## CRUD Hooks
|
|
169
|
+
|
|
170
|
+
Intercept CRUD operations with before/after handlers:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
crudOperations: {
|
|
174
|
+
create: {
|
|
175
|
+
before: async (req, params, currentUser) => {
|
|
176
|
+
params.createdBy = currentUser._id;
|
|
177
|
+
return params;
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
index: {
|
|
181
|
+
before: async (req, filter, currentUser) => {
|
|
182
|
+
filter.isActive = true;
|
|
183
|
+
return filter;
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Filter Scopes
|
|
190
|
+
|
|
191
|
+
Add auto or manual scope filters:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
filters: {
|
|
195
|
+
scopes: {
|
|
196
|
+
isAccessible: true,
|
|
197
|
+
auto: {
|
|
198
|
+
key: 'status',
|
|
199
|
+
options: ['active', 'inactive', 'pending'],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Plugins
|
|
206
|
+
|
|
207
|
+
- **Permissions** — role-based access control. See [`docs/permissions.md`](../../docs/permissions.md)
|
|
208
|
+
- **Admin Notifications** — in-app notification system. See [`docs/adminNotifications.md`](../../docs/adminNotifications.md)
|
|
209
|
+
|
|
210
|
+
## Custom Routes
|
|
211
|
+
|
|
212
|
+
For full control (you provide your own React app), extend the built-in controllers:
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import DashboardController from 'identity-admin/lib/controllers/DashboardController';
|
|
216
|
+
import ResourceController from 'identity-admin/lib/controllers/ResourceController';
|
|
217
|
+
import ActionController from 'identity-admin/lib/controllers/ActionController';
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
See the README for detailed examples.
|
|
221
|
+
|
|
222
|
+
## Common Patterns
|
|
223
|
+
|
|
224
|
+
**Override a field type:**
|
|
225
|
+
```typescript
|
|
226
|
+
properties: {
|
|
227
|
+
model: {
|
|
228
|
+
avatar: { type: 'image' as FieldTypes, mediaUploader: true },
|
|
229
|
+
description: { type: 'HTML' as FieldTypes },
|
|
230
|
+
phone: { type: 'phoneNumber' as FieldTypes, countryCodes: ['sa', 'eg'] },
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Add a virtual password field:**
|
|
236
|
+
```typescript
|
|
237
|
+
model: {
|
|
238
|
+
virtuals: {
|
|
239
|
+
password: {
|
|
240
|
+
type: 'password',
|
|
241
|
+
showIn: Virtuals.FORM,
|
|
242
|
+
required: true,
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Disable delete, enable bulk delete:**
|
|
249
|
+
```typescript
|
|
250
|
+
actions: {
|
|
251
|
+
delete: { isAccessible: false },
|
|
252
|
+
bulkDelete: { isAccessible: true },
|
|
253
|
+
},
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Red Flags
|
|
257
|
+
|
|
258
|
+
- Forgetting to add the resource to the `resources` array — the file alone isn't enough
|
|
259
|
+
- Mismatch between `modelName` and the actual Mongoose collection name
|
|
260
|
+
- Field name typos in `listProperties` / `formProperties` — they're silently ignored
|
|
261
|
+
- Missing Inversify container bindings when using the permissions plugin
|
|
262
|
+
- `authenticate` returns `false` for valid credentials — check bcrypt comparison
|
|
263
|
+
- `cookiesSecret` is required for authenticated dashboards, even in development
|
|
264
|
+
|
|
265
|
+
## Verification Checklist
|
|
266
|
+
|
|
267
|
+
- [ ] Mongoose model is connected and compiled before `dashboard.build(app)`
|
|
268
|
+
- [ ] Resource file has at minimum `properties.resource` and `properties.modelName`
|
|
269
|
+
- [ ] For authenticated dashboard: `cookiesConfiguration` is set and `authenticate` returns the user object
|
|
270
|
+
- [ ] Custom actions return a valid `IActionHandlerResponse`
|
|
271
|
+
- [ ] Plugin resources are added to the main `resources` array
|
|
272
|
+
- [ ] Before/after handlers always return the expected type (params, filter, or document)
|