Users

A single BrainFrame server can have multiple users associated with it. Each user has their own username and password, and can be assigned roles that grant them different levels of access to the server.

Note that authorization is disabled by default for BrainFrame servers. See the Authorization Configuration section in the User Manual for details.

API Methods

BrainFrameAPI.get_user(user_id, timeout=30)brainframe.api.bf_codecs.user_codecs.User

Gets the user with the given ID.

Parameters
  • user_id – The ID of the user to get

  • timeout – The timeout to use for this request

Returns

The user

BrainFrameAPI.get_users(timeout=30) → List[brainframe.api.bf_codecs.user_codecs.User]

Gets all users.

Parameters

timeout – The timeout to use for this request

Returns

Users

BrainFrameAPI.set_user(user, timeout=30)brainframe.api.bf_codecs.user_codecs.User

Creates or updates a user. Only admin users may make this request.

A new user is created if the given user’s ID is None.

Parameters
  • user – The user to create or update

  • timeout – The timeout to use for this request

Returns

Created or updated user

BrainFrameAPI.delete_user(user_id, timeout=30)

Deletes a user. Only admin users may make this request.

Parameters
  • user_id – The ID of the user to delete

  • timeout – The timeout to use for this request

Data Structures

class User(username: str, password: Optional[str], role: brainframe.api.bf_codecs.user_codecs.User.Role, id: Optional[int] = None)

Contains information on a user.

class Role(value)

Controls the level of access a user has to API endpoints.

ADMIN = 'admin'

A user that can access all endpoints.

EDITOR = 'editor'

A user that can access most endpoints but cannot do administrative tasks like adding users and managing the license.

classmethod values()
id: Optional[int] = None

The user’s unique ID

password: Optional[str]

This field will be None when retrieving users from the server. It should only be set by the client when creating a new user or updating a user’s password.

role: Role

The user’s role

username: str

The username used for login