Clawith icon indicating copy to clipboard operation
Clawith copied to clipboard

新增审批自动通过开关

Open laixiao opened this issue 8 months ago • 2 comments

Pre-checks

What problem does this solve?

希望将权限下放,避免太多人工介入,我充分了解了风险,可以给用户一个开关选项。

Proposed solution

No response

Willing to contribute?

  • [ ] I'd be interested in working on this.

laixiao avatar Mar 14 '26 05:03 laixiao

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 — AgentPermission model (lines 108-127) with access_level field 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:

  1. Add an auto_approve flag to AgentPermission:

    auto_approve: Mapped[bool] = mapped_column(Boolean, default=False)
    approval_required: Mapped[bool] = mapped_column(Boolean, default=True)
    
  2. Add a permission policy to the Agent model:

    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
        }
    )
    
  3. Update permission grant logic in the API:

    • When creating an AgentPermission, check the agent's permission_policy
    • If auto_approve=True and policy allows, skip the approval queue
    • Otherwise, add to approval workflow
  4. 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.

Clawiee avatar Mar 14 '26 05:03 Clawiee

可以在setting中直接修改审批策略

Image

wisdomqin avatar Mar 14 '26 10:03 wisdomqin