steps.api.cloud_objects.cloud_user
Attributes
Classes
User class representing a user in the cloud system. |
Module Contents
- steps.api.cloud_objects.cloud_user.ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*.!@#$%^&(){}[]:;<>,.?/~_+-=|\\'[source]
- class steps.api.cloud_objects.cloud_user.User(first_name: str = '', last_name: str = '', user_id: int = -1, email: str = '', password: str = '', platform_ids: list[str] = [], is_admin: bool = False, priority: int = 2, company_id: int = None, **kwargs)[source]
Bases:
steps.api.cloud_objects.cloud_base.ACloudObjectUser class representing a user in the cloud system.
This class handles all user-related operations including user creation, authentication, token management, and CRUD operations.
- Parameters:
first_name – User’s first name
last_name – User’s last name
user_id – User’s ID (defaults to -1 for new users)
email – User’s email address
password – User’s password
platform_ids – List of platform IDs the user has access to
is_admin – Whether the user has admin privileges
priority – User’s priority level (default: 2)
company_id – User’s company ID
kwargs – Additional attributes to set on the user
- classmethod get_api(context: steps.api.utils.CloudContext) steps.api.utils.Api[source]
- get_token(token_type: steps.api.cloud_objects.cloud_base.TokenType) None[source]
Get a token of the specified type for this user.
- Parameters:
token_type – Type of token to retrieve
- Returns:
Token string for the requested token type
- Raises:
NotImplementedError – If the token type is not supported
- job_tokens: list[steps.api.cloud_objects.cloud_token.JobToken] = [][source]
- api_key: steps.api.cloud_objects.cloud_token.ApiKey = None[source]
- generate_data() None[source]
Generate email and password data for this user.
Creates a standardized email based on first and last name, and generates a secure random password that meets complexity requirements.
- create(context: steps.api.utils.CloudContext, user: User) None[source]
Create this user in the cloud.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication for the creation
- Raises:
RuntimeError – If user creation fails
AssertionError – If trying to create an admin user
- read(context: steps.api.utils.CloudContext, user=None) dict[str][source]
Read this user’s information from the cloud.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication (defaults to self)
- Returns:
Dictionary with user data from response
- Raises:
RuntimeError – If reading user data fails
AssertionError – If the user has not been created yet
- update(context: steps.api.utils.CloudContext, user, update_dict: dict[str]) None[source]
Update this user’s information in the cloud.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication (defaults to self)
update_dict – Dictionary with fields to update
- Raises:
RuntimeError – If updating user data fails
AssertionError – If the user has not been created yet
- delete(context: steps.api.utils.CloudContext, user: User) None[source]
Delete this user from the cloud.
- Parameters:
context – Cloud context for API configuration
user – User providing authentication
- Raises:
RuntimeError – If deleting the user fails
AssertionError – If the user has not been created or is an admin
- log(context: steps.api.utils.CloudContext) None[source]
Login the user and obtain a login token.
- Parameters:
context – Cloud context for API configuration
- Raises:
AssertionError – If the user is not an admin and hasn’t been created
- create_job_token(context: steps.api.utils.CloudContext, token_dict: dict[str]) None[source]
Create a job token for this user.
- Parameters:
context – Cloud context for API configuration
token_dict – Dictionary with token parameters
- Raises:
AssertionError – If the user hasn’t been created
- create_api_key(context: steps.api.utils.CloudContext, api_key_dict: dict[str]) None[source]
Create an API key for this user.
- Parameters:
context – Cloud context for API configuration
api_key_dict – Dictionary with API key parameters
- Raises:
AssertionError – If the user hasn’t been created
- classmethod list_all(context: steps.api.utils.CloudContext, admin: User) list[User][source]
List all users in the cloud.
- Parameters:
context – Cloud context for API configuration
admin – Admin user providing authentication
- Returns:
List of User objects
- Raises:
RuntimeError – If listing users fails
AssertionError – If the authenticating user is not an admin