Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend add_user API to add roles to a user #127

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion client/src/cbltest/api/syncgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,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 @@ -536,6 +541,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
Loading