578
``ACTIVE`` connection on this auth config. Pair with ``alias`` and a
579
session-level ``multi_account`` config to disambiguate at execution time.
580
:param account_type: Sharing model for the new connection. ``PRIVATE``
581
- (default) is usable only by the owning ``user_id``. ``SHARED`` is
582
- reachable from a tool-router session by other users in the project,
583
- but only when explicitly pinned and only when the requesting
584
- ``user_id`` passes the connection's ACL. Set at create time only.
585
- :param acl_config_for_shared: Per-user ACL for SHARED connections. Only
586
- valid when ``account_type == 'SHARED'`` — the backend rejects ACL
587
- on a PRIVATE connection with ``ComposioAclOnlyForSharedError``
588
- (400). Pass an ``ACLConfigForShared`` dict with any combination of
581
+ (default) is usable only by the owning ``user_id``. ``SHARED`` can
582
+ be used by other ``user_id``s — but only when the connection is
583
+ explicitly pinned in a tool-router session's config and only when
584
+ the requesting ``user_id`` passes the connection's ACL.
585
+ :param acl_config_for_shared: Per-user ACL for SHARED connections.
586
+ Only valid when ``account_type == 'SHARED'``; raises
587
+ ``ComposioAclOnlyForSharedError`` on a PRIVATE connection. Pass
588
+ an ``ACLConfigForShared`` dict with any combination of
589
``allow_all_users``, ``allowed_user_ids``, ``not_allowed_user_ids``.
590
Omit to keep deny-by-default (only the creator can use).
591
:return: Connection request object.
652
),
653
)
654
except BadRequestError as error:
655
- # Backend rejects ACL on PRIVATE rows with 400 +
656
- # ``ConnectedAccount_AclOnlyForShared``. Surface it as a typed
657
- # error so callers can ``except`` instead of grepping messages.
655
+ # The server rejects ACL on PRIVATE connections — surface that
656
+ # as a typed error so callers can ``except`` instead of grepping
657
+ # messages.
658
message = str(error)
659
if "acl_config_for_shared is only valid on SHARED" in message:
660
raise exceptions.ComposioAclOnlyForSharedError(message) from error
678
"""
679
Update the per-user ACL on a SHARED connected account.
680
681
- Only meaningful for SHARED connections — the backend rejects ACL
682
- writes on PRIVATE rows with ``ComposioAclOnlyForSharedError`` (400).
683
- Auth gate is creator-or-API-key (a non-creator project member
684
- updating an alias on a SHARED row still works via :meth:`update`,
685
- but ACL writes do not).
686
-
687
- PATCH semantics: omit a parameter to leave it unchanged; pass an
688
- empty list to clear an allow/deny list. At least one parameter must
689
- be provided — calling with all three as ``None`` raises
690
- :class:`composio.exceptions.ValidationError`.
691
-
692
- Resolution rule (deny wins):
693
- 1. requesting user_id in ``not_allowed_user_ids`` → DENY
694
- 2. ``allow_all_users == True`` → ALLOW
695
- 3. requesting user_id in ``allowed_user_ids`` → ALLOW
696
- 4. otherwise → DENY
681
+ Only valid on SHARED connections; raises
682
+ ``ComposioAclOnlyForSharedError`` on a PRIVATE connection. Omit a
683
+ parameter to leave it unchanged; pass an empty list to clear an
684
+ allow/deny list. At least one parameter must be provided.
685
686
:param nanoid: The connected account ID (``ca_xxx``).
699
- :param allow_all_users: Wildcard "any user_id in the project" allow.
700
- :param allowed_user_ids: Explicit allow list. Pass ``[]`` to clear.
687
+ :param allow_all_users: When True, any ``user_id`` may use this
688
+ SHARED connection (subject to the deny list).
689
+ :param allowed_user_ids: Explicit list of allowed ``user_id`` strings.
690
+ Pass ``[]`` to clear.
691
:param not_allowed_user_ids: Explicit deny list (wins over allow on
692
conflict). Pass ``[]`` to clear — note that clearing the deny
693
list silently re-grants access to previously-blocked users.
704
- :return: PATCH response (``id``, ``status``, ``success``). To read
705
- back the updated ``acl_config_for_shared`` block, call
706
- :meth:`get` after this returns.
707
-
708
- Example::
709
-
710
- # Open access to everyone in the project
711
- composio.connected_accounts.update_acl('ca_abc', allow_all_users=True)
694
+ :return: Response with ``id``, ``status``, and ``success``.
695
713
- # Everyone except a specific user
696
+ Example:
697
composio.connected_accounts.update_acl(
698
'ca_abc',
699
allow_all_users=True,
700
not_allowed_user_ids=['user_bob'],
701
)
719
-
720
- # Targeted allow
721
- composio.connected_accounts.update_acl(
722
- 'ca_abc',
723
- allowed_user_ids=['user_alice', 'user_bob'],
724
- )
725
-
726
- # Revoke a previously-granted allow list (back to deny-by-default)
727
- composio.connected_accounts.update_acl('ca_abc', allowed_user_ids=[])
702
"""
703
if (
704
allow_all_users is None