Authentication and User Management#

class AuthTypeEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

password = 'password'#
is_valid_password(password)[source]#
Parameters:

password (str)

Return type:

None

is_valid_username(username)[source]#
Parameters:

username (str)

Return type:

None

is_valid_groupname(groupname)[source]#
Parameters:

groupname (str)

Return type:

None

is_valid_rolename(rolename)[source]#
Parameters:

rolename (str)

Return type:

None

pydantic model PolicyStatement[source]#

Bases: BaseModel

A statment of permissions for a role

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field Effect: str [Required]#

The effect of the permission (Allow, Deny)

field Action: str | List[str] [Required]#

The actions this permission applies to (GET, POST, etc). May be ‘*’ to apply to all.

field Resource: str | List[str] [Required]#

The resource this permission applies to. Usually the first part of the path (molecules, keywords, etc). May be ‘*’ to apply to all.

pydantic model PermissionsPolicy[source]#

Bases: BaseModel

Permissions assigned to a role

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Config:
  • extra: Extra = Extra.forbid

Fields:
field Statement: List[PolicyStatement] [Required]#

Permission statements

pydantic model RoleInfo[source]#

Bases: BaseModel

Information about a role

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Config:
  • extra: Extra = Extra.forbid

Fields:
Validators:
field rolename: str [Required]#

The name of the role

Validated by:
  • _valid_rolename

field permissions: PermissionsPolicy [Required]#

The permissions associated with this role

pydantic model GroupInfo[source]#

Bases: BaseModel

Information about a group

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Config:
  • extra: Extra = Extra.forbid

Fields:
Validators:
field id: int | None = None#

ID of the group

field groupname: str [Required]#

The name of the group

Validated by:
  • _valid_groupname

field description: str = ''#

Text description of the group

pydantic model UserInfo[source]#

Bases: BaseModel

Information about a user

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Config:
  • extra: Extra = Extra.forbid

  • validate_assignment: bool = True

Fields:
Validators:
field id: int | None = None#

The id of the user

field auth_type: AuthTypeEnum = AuthTypeEnum.password#

Type of authentication the user uses

field username: str [Required]#

The username of this user

Validated by:
  • _valid_username

field role: str [Required]#

The role this user belongs to

Validated by:
  • _valid_rolename

field groups: List[str] = []#

Groups this user belongs to

Validated by:
  • _valid_groupnames

field enabled: bool [Required]#

Whether this user is enabled or not

field fullname: ConstrainedStrValue = ''#

The full name or description of the user

Constraints:
  • maxLength = 128

field organization: ConstrainedStrValue = ''#

The organization the user belongs to

Constraints:
  • maxLength = 128

field email: ConstrainedStrValue = ''#

The email address for the user

Constraints:
  • maxLength = 128