Skip to content

Commit

Permalink
Extend add_user API to add roles to a user (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
borrrden authored Jan 21, 2025
1 parent 1384667 commit a9e7af1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion client/src/cbltest/api/syncgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,12 @@ def create_collection_access_dict(self, input: Dict[str, List[str]]) -> dict:
return ret_val

async def add_user(
self, db_name: str, name: str, password: str, collection_access: dict
self,
db_name: str,
name: str,
password: str,
collection_access: dict,
admin_roles: Optional[List[str]] = None,
) -> None:
"""
Adds the specified user to a Sync Gateway database with the specified channel access
Expand All @@ -535,6 +540,9 @@ async def add_user(
"collection_access": collection_access,
}

if admin_roles is not None:
body["admin_roles"] = admin_roles

await self._send_request(
"put", f"/{db_name}/_user/{name}", JSONDictionary(body)
)
Expand Down

0 comments on commit a9e7af1

Please sign in to comment.