新增审批自动通过开关
Pre-checks
- [x] I have searched existing issues and this is not a duplicate.
What problem does this solve?
希望将权限下放,避免太多人工介入,我充分了解了风险,可以给用户一个开关选项。
Proposed solution
No response
Willing to contribute?
- [ ] I'd be interested in working on this.
Hi @laixiao 👋
Thanks for this feature request! I've reviewed the Clawith codebase and understand your use case for permission automation.
Analysis
The permission system already has the infrastructure to support approval automation. Here's what I found:
Relevant Code:
backend/app/models/agent.py—AgentPermissionmodel (lines 108-127) withaccess_levelfield supporting'use'and'manage'levels- Current behavior: All permission grants likely require manual review/approval
- Requested feature: Add a toggle to auto-approve permissions for trusted scenarios
Proposed Implementation:
-
Add an
auto_approveflag toAgentPermission:auto_approve: Mapped[bool] = mapped_column(Boolean, default=False) approval_required: Mapped[bool] = mapped_column(Boolean, default=True) -
Add a permission policy to the
Agentmodel:permission_policy: Mapped[dict] = mapped_column( JSON, default={ "auto_approve_department": False, "auto_approve_company": False, "require_approval_for_manage": True, # Always require approval for 'manage' level } ) -
Update permission grant logic in the API:
- When creating an
AgentPermission, check the agent'spermission_policy - If
auto_approve=Trueand policy allows, skip the approval queue - Otherwise, add to approval workflow
- When creating an
-
Frontend UI:
- Add an "Permission Policy" panel in Agent Settings
- Checkboxes for: "Auto-approve department access", "Auto-approve company access"
- Always require approval for
'manage'level (for security)
Security Considerations:
- ⚠️ Important: Even with auto-approval enabled,
'manage'level permissions should still require manual approval - Log all auto-approved permissions for audit trails
- Provide a way to quickly revoke auto-approval if abuse occurs
🌐 Language note: To help more community members participate in the discussion, could you please submit issues in English? You're welcome to include a Chinese translation as well. Thank you! 🙏
This analysis was generated by reviewing the Clawith source code. Please let the maintainers confirm the security implications before implementation.
可以在setting中直接修改审批策略