Conversation
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
参考主流低代码平台的实现方案,我需要区分 profile permission-set吗? 还有role在哪里定义 |
|
好问题!我的实现参考了 Salesforce 的行业标准做法: 1. Profile vs Permission Set 的区分是必要的:
使用场景: 这种设计的优势是灵活性 - 可以通过组合而非修改来扩展权限。 2. Role 的定义位置: 目前实现支持两个层级:
# main.app.yml
permissions:
roles: [admin, manager, developer, user, viewer]
# projects.permission.yml
roles: # 这里是引用系统级定义的 roles
- admin
- manager建议在 ApplicationConfig 中集中定义 roles,permission 文件中只引用它们,这样可以保证一致性。我会更新文档说明这一点。 |
…ction - Add system-wide role definition in demo.app.yml - Update PERMISSIONS_GUIDE.md with comprehensive explanation of: - Role definition strategy (central vs per-object) - Profile vs Permission Set distinction (following Salesforce model) - When to use each pattern - Add documentation comments to permission.ts explaining roles field - Update permission examples to clarify roles are references - Add usage examples showing effective permission calculation Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
salesforce中 permission set 相当于 role,而且没有必要要分拆profile @copilot |
你说得对!我重新理解了: 在 ObjectQL 中,我们应该采用更简单的 RBAC 模型: 当前实现已经支持基于 Role 的权限: # projects.permission.yml
roles: [admin, manager, user]
object_permissions:
create: [admin, manager] # 直接用 role 控制权限
read: [admin, manager, user]Profile 和 Permission Set 应该是可选的高级特性,不是核心概念。 大多数场景下,只需要:
Profile/PermissionSet 只在需要复杂权限组合时才用。 你建议我简化文档和示例,去掉 Profile/PermissionSet 的强调,把它们作为可选功能吗?还是保持现状但在文档中澄清 Role 是主要方式? |
|
按照 rbac 帮我优化所有文档和代码,作废 profile, permission set @copilot |
…onSet Remove Profile and PermissionSet concepts to simplify the permission model: - Remove PermissionProfile and PermissionSet interfaces from permission.ts - Remove profiles and permission_sets fields from PermissionConfig - Remove profiles and permission_sets from tasks.permission.yml example - Update PERMISSIONS_GUIDE.md to focus on RBAC with roles - Remove Profile/PermissionSet sections from documentation - Update best practices to emphasize role-based design The system now follows pure Role-Based Access Control (RBAC): - Roles define user groups (admin, manager, user, etc.) - Permissions assigned directly to roles - No intermediate profile/permission set complexity - Simpler, more straightforward permission model Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
已完成 RBAC 简化,提交 8f34798: 移除的内容:
保留的核心功能:
现在的权限模型更简单直接:通过角色定义权限,无需 Profile/PermissionSet 的额外复杂度。 |
|
更新规范文档 @copilot |
Update docs/spec/permission.md to align with RBAC model: - Update overview to emphasize Role-Based Access Control (RBAC) - Remove section 7 "Profile-Based Permissions" - Remove section 8 "Permission Sets" - Renumber remaining sections (9->7, 10->8, 11->9, etc.) - Update best practices: replace "Role Hierarchy" with "Define Clear Roles" - Maintain all other sections: object/field permissions, record rules, sharing, actions, views, security features The specification now accurately documents the simplified RBAC permission model without Profile/PermissionSet concepts. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
已更新规范文档,提交 4c894f2: 更新内容(docs/spec/permission.md):
规范文档现在完全对齐 RBAC 模型,移除了 61 行 Profile/PermissionSet 相关内容。 |
There was a problem hiding this comment.
Pull request overview
This pull request implements comprehensive RBAC (Role-Based Access Control) permission metadata types and examples for ObjectQL. The implementation provides TypeScript type definitions for a complete permission system including object-level permissions, field-level security, record-level rules, sharing rules, action permissions, view permissions, and advanced security features.
Changes:
- Added TypeScript type definitions for permission metadata in
packages/types/src/permission.ts - Exported permission types from the main types package
- Created comprehensive example permission files demonstrating various RBAC scenarios
- Added system-wide role definitions to the demo application configuration
- Created detailed documentation guide explaining the permission system
- Updated the permission specification to emphasize the pure RBAC model
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/types/src/permission.ts | Comprehensive TypeScript type definitions for RBAC permission system (477 lines) including interfaces for object/field/record permissions, sharing rules, actions, views, and security features |
| packages/types/src/index.ts | Export statement added for permission types |
| examples/starters/basic-script/src/tasks.permission.yml | Advanced permission rules example demonstrating complex scenarios including lookup conditions, sharing rules, RLS, and audit configuration |
| examples/starters/basic-script/src/projects.permission.yml | Enhanced example with comprehensive permission features for projects object |
| examples/starters/basic-script/src/demo.app.yml | Added central role definitions (admin, manager, developer, user, viewer) |
| examples/starters/basic-script/PERMISSIONS_GUIDE.md | 345-line comprehensive guide explaining RBAC concepts, examples, and best practices |
| docs/spec/permission.md | Updated specification emphasizing RBAC model, removed Profile/PermissionSet concepts, renumbered sections correctly |
| - project_manager | ||
| - team_lead |
There was a problem hiding this comment.
Role mismatch detected: The tasks.permission.yml file references roles "project_manager" and "team_lead" which are not defined in demo.app.yml. The demo.app.yml only defines the following roles: admin, manager, developer, user, viewer.
Either update demo.app.yml to include these roles, or update tasks.permission.yml to use the existing roles defined in demo.app.yml (e.g., use "manager" instead of "project_manager").
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Permission Metadata Implementation
packages/types/src/permission.tspackages/types/src/index.ts*.permission.ymlfiles (confirmed in core/src/loader.ts line 107)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.