/// <summary> /// Alter the admin privilege of a given database user. /// </summary> /// <param name="database">The name of the database where this user is allowed.</param> /// <param name="name">The name of the existing database user.</param> /// <param name="isAdmin">If set to true this user is a database admin, otherwise it isnt.</param> /// <param name="permissions">An array of readFrom and writeTo permissions (in this order) and given in regex form.</param> /// <returns></returns> public async Task<InfluxDbApiResponse> AlterDatabasePrivilegeAsync(string database, string name, bool isAdmin, params string[] permissions) { var user = new User { Name = name, IsAdmin = isAdmin }; user.SetPermissions(permissions); return await _influxDbClient.UpdateDatabaseUser(NoErrorHandlers, database, user, name); }
/// <summary> /// Update the password and/or the permissions of a database user. /// </summary> /// <param name="database">The name of the database where this user is allowed.</param> /// <param name="name">The name of the existing database user.</param> /// <param name="password">The password for this user.</param> /// <param name="permissions">An array of readFrom and writeTo permissions (in this order) and given in regex form.</param> /// <returns></returns> public async Task<InfluxDbApiResponse> UpdateDatabaseUserAsync(string database, string name, string password, params string[] permissions) { var user = new User { Name = name, Password = password }; user.SetPermissions(permissions); return await _influxDbClient.UpdateDatabaseUser(NoErrorHandlers, database, user, name); }