본문으로 건너뛰기
Skillpedia
보안25k · #10093

nocobase-app-plugin-authz-sharing-rules

하는 일

이 스킬은 NocoBase 3 업무 작업의 공유 규칙을 설정합니다. 협업을 위해 특정 레코드를 다른 사람과 공유해야 하는 관리자를 위한 스킬입니다.

사용하는 경우

  • ✓한 사람이 특정 레코드를 다른 사람이나 부서와 공유해야 할 때.
  • ✓한 부서가 정해진 작업을 위해 다른 부서의 레코드에 접근해야 할 때.
  • ✓운영 환경에서 공유 규칙을 확인하거나 관리해야 할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-authz-sharing-rules/skills/nocobase-app-plugin-authz-sharing-rules/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“재무팀이 평소 권한에 더해 이 프로젝트 세 개를 볼 수 있도록 해 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 나열된 사람이나 부서에 선택된 레코드를 추가하는 공유 규칙을 만듭니다. 이 규칙은 이미 작업 권한을 가진 사람에게만 작동하며, 모든 레코드를 선택할 수는 없습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Develop sharing rules

A sharing rule adds selected records, or a record access selection, for the subjects it lists, provided they already hold the action. Sharing does not grant the operation, fields, page access or related records, and it cannot select all records. Grants, default access and sharing combine first; restriction rules then narrow the result.

Read the installed nocobase-app-plugin-authorization Skill first for composite resources, data scopes, fields, server policy enforcement and inherited subjects. The package README at node_modules/@nocobase/app-plugin-authz-sharing-rules/README.md is the complete reference for the service, the HTTP routes and the exports; this Skill covers how to use them.

For sharing between departments, read the application development Skill's references/organization/permission-design.md first. A rule whose recipient is a department shares specific records with it; a viewer-relative department scope such as 本部门及下属部门 is computed for the viewer and cannot select another department's records. The guide's optional sharing section covers this plugin, and its core section says what remains with permission sets alone.

Development workflow

  1. Identify the real collaboration exception: who receives which records, for which actions, and why. Use explicit records for one handover; use a record access selection for a maintained region or team rule.
  2. Grant the recipients the business action through a permission set first. Register inherited subjects and their active membership resolver through the main authorization Skill.
  3. Inspect every data scope the operation requires. Quote submission needs the selected quote and its actual parent project. Add each action and data scope deliberately; view, edit and submit are different permissions.
  4. Save a complete rule through the HTTP routes or the service. Keep record ids tied to their data scope's collection and preserve the other entries on update.
  5. Verify the handover works, an unshared parent still blocks the workflow, restrictions still exclude confidential records, and sharing alone cannot activate a missing operation.
  6. Revoke the recipient or the team's permission set and verify the next request loses only that source. Independent direct-user sharing and direct assignments must survive.

For example, a quote handover shares quote edit and submit plus the parent project's submit scope with a delegated engineer. Use the real record ids, never sample ones.

Install

Register the default export of @nocobase/app-plugin-authz-sharing-rules/client in client/plugins.ts and of @nocobase/app-plugin-authz-sharing-rules/server in server/plugins.ts, beside the main authorization plugin, and run the application's migrations. Add the factory to the plugins of server/config/authorization.ts, merged with the application's other rule factories:

import { sharingRules } from '@nocobase/app-plugin-authz-sharing-rules/server';
import {
  defineAppConfig,
  type AppConfigFactory,
} from '@nocobase/app-server/config';
import type { AuthorizationConfig } from '@nocobase/app-plugin-authorization/server';

const authorization: AppConfigFactory<AuthorizationConfig> = defineAppConfig(
  () => ({ plugins: [sharingRules()] }),
);
export default authorization;

During setup the factory registers the settings item authorization.sharing-rules (group authorization, actions read, create, update, delete) and its routes under /api/authorization/sharingRules, which the running application documents at /api/swagger/docs under the Authorization tag. Without the factory in the configuration the plugin adds no API and no route.

Service API

Resolve authorizationToken from @nocobase/app-plugin-authorization/server in the owning provider or route factory. The rule API exists only when the factory is configured, so narrow the service before using it. quotes is the application's own composite and org.team its own subject type, both defined as the main Skill describes.

import { selection } from '@nocobase/authorization/core';
import {
  defineSharingRule,
  type SharingRulesAuthorizationApi,
} from '@nocobase/authorization/sharing-rules';
import type { DatabaseConnection } from '@nocobase/db';

if (!('sharingRules' in authz))
  throw new Error('Sharing rules is not configured');
const rules = (
  authz as typeof authz & SharingRulesAuthorizationApi<DatabaseConnection>
).sharingRules;

await rules.create(
자주 묻는 질문

공유가 새 권한을 주나요?

아니요. 이미 작업 권한을 가진 사람에게만 레코드를 추가합니다.

모든 레코드를 한 번에 공유할 수 있나요?

아니요. 공유에서는 모든 레코드를 선택할 수 없습니다.

제한 규칙과는 어떻게 작동하나요?

제한 규칙이 나중에도 계속 적용되며, 결과를 좁힐 수 있습니다.

상세 정보

작성자의 원본 설명

Design, implement and verify sharing rules for NocoBase 3 business operations, including named data scopes and production administration.

repo: nocobase/nocobase

인기도

GitHub 스타
25k
순위
#10093
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬