Перейти к содержанию
Skillpedia
Безопасность25k · #10107

nocobase-app-plugin-users

Что он делает

Этот скилл интегрирует плагин Users NocoBase в приложение и строит страницу управления пользователями на его API. Он нужен администраторам и разработчикам, которые управляют учетными записями в приложении.

Когда использовать

  • ✓Когда вам нужна админ-страница для создания, отключения или сброса учетных записей.
  • ✓Когда другому плагину нужно добавить свои роли в управление пользователями.
  • ✓Когда нужно настроить права плагина пользователей.

Ссылка на скилл

https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-users/skills/nocobase-app-plugin-users/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-users/skills/nocobase-app-plugin-users/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Добавьте в моё приложение NocoBase страницу управления пользователями, где администраторы смогут приглашать людей и отключать аккаунты.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

ИИ регистрирует плагин и строит страницу на его API для просмотра, создания, обновления, отключения и сброса. Хранение учетных записей и сессий остается за плагином аутентификации.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

User Management App Plugin

Use this Skill when an application needs user management, or when another plugin needs to expose application-specific roles in user management. Do not use it to modify the Users plugin source or to replace Authentication's user, account, or Session storage.

Public surfaces

  • Client registration factory and UsersClientOptions: @nocobase/app-plugin-users/client. It contributes only the public invitation page at /invite/:token; there is no user management page.
  • Typed API client: UsersClient and its types from @nocobase/app-plugin-users/client/user-client.
  • Server contracts: userManagementServiceToken, userRoleScopeRegistryToken, UserRoleScope, and related types from @nocobase/app-plugin-users/server/tokens.
  • HTTP API: GET /api/users (page, pageSize, q, status, roleScope, role, sort=name, order=asc|desc; answers { data, meta: { page, pageSize, total } }), GET /api/users/options, GET /api/users/:userId (latest managed profile and role scopes, requires user/read, 404 for absent accounts), POST /api/users, PATCH /api/users/:userId, DELETE /api/users/:userId?confirm=true, POST /api/users/:userId/disable|enable|resetPassword|revokeSessions, and PUT /api/users/:userId/roleScopes/:scope. The running application documents each one, with request and response schemas, at /api/swagger/docs (JSON at /api/swagger) under the Users tag. Failures use the standard error body; branch on error.reason, such as USER_NOT_FOUND, SELF_DELETE_NOT_ALLOWED, LAST_ASSIGNMENT or USER_EMAIL_CONFLICT.

UsersClient.update(userId, { name?, username?, email?, roleScopes? }) supports one atomic editor Save. Profile fields require update; submitted roleScopes additionally require assign-role. A roles-only payload requires assign-role without update. The service validates scope values, runs each applicable target-account guard, and commits profile changes and all submitted scope replacements in the caller-owned transaction, notifying permission clients only after commit. Omitted scopes are preserved. Keep the existing per-scope PUT for callers needing only one scope. Do not implement a combined Save as sequential profile and role requests: a later failure would leave a partially saved account.

Every HTTP route requires Authentication and Authorization. Routes check the user record type with the applicable action from read, create, update, disable, enable, assign-role, reset-password, revoke-sessions or delete. Account creation checks both create and assign-role. delete is permitted only while an application role scope can clean a deleted user up.

Register the plugin

  1. Register Authentication, Authorization, and then Users in the App's Client and Server plugin arrays. The Client factory takes no placement options: users().
  2. Grant only the user actions those roles need, on { type: 'user', id: '*' } because user is a record type. The plugin creates no roles and grants no access by itself.
  3. For a user management page, build it in the App on UsersClient and declare it among the App's own routes with the page access it needs; the plugin ships none.

The invitation page reports results through useToaster() from @nocobase/app-client, so the App needs the @nocobase/app-client that exports it and registers a toaster service, as the templates do: client/lib/toaster.ts from the template, and this.app.container.instance(toasterToken, createToaster()) in the register() of client/service-provider.ts, with the Toaster component mounted in client/react-providers.ts. Without the registration nothing throws, but its toasts are only logged to the browser console.

The default app permission-set scope is supplied by Users whenever the Authorization plugin's authorizationToken is available. Do not copy a user-roles Provider into an application. Set users.permissionSets: false to replace the default with an application-owned scope.

Add an application role scope

Resolve userRoleScopeRegistryToken in an application or business plugin ServiceProvider and register one UserRoleScope during boot(). The scope owns its available options, current assignment lookup, role filtering, atomic replacement, and any disable guard. Unregister it during shutdown().

Use the DatabaseConnection passed to each scope method. This is the caller-owned transaction used to keep account cr

Частые вопросы

Заменяет ли он систему входа?

Нет. Учетные записи и сессии хранит плагин аутентификации.

Есть ли админ-страница по умолчанию?

Нет. Плагин добавляет только публичную страницу приглашения, поэтому админ-страницу вы создаете сами.

Может ли приложение добавлять свои роли?

Да, через контракт области ролей, который предоставляют приложение или другой плагин.

Подробности

Оригинальное описание автора

Integrate the Users plugin into a NocoBase App, build a user management page on its API and configure its permissions, or add an application-owned role scope through the public Server contracts.

repo: nocobase/nocobase

Популярность

Звёзды на GitHub
25k
Место в рейтинге
#10107
Лицензия
—
Обновлён
02.11.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы