Skip to content

Commit f723127

Browse files
committed
Add grant_admin_privileges() to InfluxDBClient
This allows users to easily alter the 'admin' attribute of a user account and complements the already existing 'revove_admin_privileges' method.
1 parent 765fa0a commit f723127

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

influxdb/client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,18 @@ def delete_series(self, database=None, measurement=None, tags=None):
684684
for k, v in tags.items()])
685685
self.query(query_str, database=database)
686686

687+
def grant_admin_privileges(self, username):
688+
"""Grant cluster administration privileges to a user.
689+
690+
:param username: the username to grant privileges to
691+
:type username: str
692+
693+
.. note:: Only a cluster administrator can create/drop databases
694+
and manage users.
695+
"""
696+
text = "GRANT ALL PRIVILEGES TO {0}".format(username)
697+
self.query(text)
698+
687699
def revoke_admin_privileges(self, username):
688700
"""Revoke cluster administration privileges from a user.
689701

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy