Skip to main content

FiscusUser Class (API Reference)

The FiscusUser class represents a user in the Fiscus SDK and provides methods for managing connectors, authentication, context, dynamic preferences, and Role-Based Access Control (RBAC).

Initialization

__init__

__init__(self, user_id: str, client: Optional['FiscusClient'] = None)

Parameters:
  • user_id (str): A unique identifier for the user.
  • client (Optional[FiscusClient]): Reference to the parent FiscusClient instance.

Methods

add_connector

add_connector(self, connector_name: str) -> None

Adds a connector to the user's list of connectors.

Parameters:
  • connector_name (str): Name of the connector.
Returns:
  • None.

remove_connector

remove_connector(self, connector_name: str) -> None

Removes a connector from the user's list of connectors.

Parameters:
  • connector_name (str): Name of the connector.
Returns:
  • None.

authenticate_connector

authenticate_connector(self, connector_name: str, auth_params: Optional[Dict[str, Any]] = None) -> None

Authenticates a connector for the user.

Parameters:
  • connector_name (str): Name of the connector.
  • auth_params (Optional[Dict[str, Any]]): Authentication parameters. If not provided, the authentication callback will be used if set.
Returns:
  • None.

deauthenticate_connector

deauthenticate_connector(self, connector_name: str) -> None

Deauthenticates a connector for the user.

Parameters:
  • connector_name (str): Name of the connector.
Returns:
  • None.

list_connected_connectors

list_connected_connectors(self) -> List[str]

Lists all connected connectors for the user.

Returns:
  • List[str]: A list of connector names.

set_context

set_context(self, key: str, value: Any) -> None

Sets a context variable for the user.

Parameters:
  • key (str): The context key.
  • value (Any): The context value.
Returns:
  • None.

get_context

get_context(self, key: str) -> Any

Gets the value of a context variable for the user.

Parameters:
  • key (str): The context key.
Returns:
  • Any: The value of the context variable.

set_auth_callback

set_auth_callback(self, callback: Callable[[str], Dict[str, Any]]) -> None

Sets the authentication callback function for connectors.

Parameters:
  • callback (Callable[[str], Dict[str, Any]]): The callback function used for authentication.
Returns:
  • None.

assign_role

assign_role(self, role: str) -> None

Assigns a role to the user for Role-Based Access Control (RBAC).

Parameters:
  • role (str): The role to assign to the user.
Returns:
  • None.

add_policy

add_policy(self, policy: Dict[str, Any]) -> None

Adds a policy to the user for Role-Based Access Control (RBAC).

Parameters:
  • policy (Dict[str, Any]): A dictionary representing the policy.
Returns:
  • None.

has_permission

has_permission(self, connector_name: str, operation: str) -> bool

Checks if the user has permission to perform a specific operation on a connector.

Parameters:
  • connector_name (str): Name of the connector.
  • operation (str): Name of the operation.
Returns:
  • bool: True if the user has permission, False otherwise.

set_user_id

set_user_id(self, new_user_id: str) -> None

Sets a new user ID for the user.

Parameters:
  • new_user_id (str): The new user ID.
Returns:
  • None.

get_connectors_info

get_connectors_info(self) -> Dict[str, Any]

Gets detailed information about the user's connected connectors.

Returns:
  • Dict[str, Any]: A dictionary containing information about each connected connector.

set_dynamic_preferences

set_dynamic_preferences(self, preferences: Dict[str, str]) -> None

Sets dynamic preferences for the user, such as custom configurations for connectors.

Parameters:
  • preferences (Dict[str, str]): A dictionary of preferences.
Returns:
  • None.