Skip to content

cattle_grid.account.models

cattle_grid.account.models

Account

Bases: Model

Represents an Account

Source code in cattle_grid/account/models.py
class Account(Model):
    """Represents an Account"""

    id = fields.IntField(primary_key=True)

    name = fields.CharField(max_length=255)
    """The account name"""

    password_hash = fields.CharField(max_length=255)
    """The hashed password"""

    actors: fields.ReverseRelation["ActorForAccount"]
    """Actors associated with this account"""

    token: fields.ReverseRelation["AuthenticationToken"]
    """Authentication tokens for this account"""

    permissions: fields.ReverseRelation["Permission"]
    """Permissions the account has"""

    meta_information = fields.JSONField(
        default={},
    )
    """Additional information about the account"""

actors instance-attribute

actors: ReverseRelation[ActorForAccount]

Actors associated with this account

meta_information class-attribute instance-attribute

meta_information = JSONField(default={})

Additional information about the account

name class-attribute instance-attribute

name = CharField(max_length=255)

The account name

password_hash class-attribute instance-attribute

password_hash = CharField(max_length=255)

The hashed password

permissions instance-attribute

permissions: ReverseRelation[Permission]

Permissions the account has

token instance-attribute

token: ReverseRelation[AuthenticationToken]

Authentication tokens for this account

ActorForAccount

Bases: Model

Lists the actors associated with the account

Source code in cattle_grid/account/models.py
class ActorForAccount(Model):
    """Lists the actors associated with the account"""

    id = fields.IntField(primary_key=True)

    account: fields.ForeignKeyRelation[Account] = fields.ForeignKeyField(
        "ap_models.Account", related_name="actors"
    )
    actor = fields.CharField(max_length=255, description="The uri of the actor")
    """The URI of the actor"""
    name = fields.CharField(
        max_length=255,
        description="human readable name for the actor",
        default="NO NAME",
    )
    """internal name of the actor, used for the human behind the account to identify it"""
    status = fields.CharEnumField(ActorStatus, default=ActorStatus.active)
    """status"""

    groups: fields.ReverseRelation["ActorGroup"]
    """Groups the actor is a member of"""

actor class-attribute instance-attribute

actor = CharField(
    max_length=255, description="The uri of the actor"
)

The URI of the actor

groups instance-attribute

groups: ReverseRelation[ActorGroup]

Groups the actor is a member of

name class-attribute instance-attribute

name = CharField(
    max_length=255,
    description="human readable name for the actor",
    default="NO NAME",
)

internal name of the actor, used for the human behind the account to identify it

status class-attribute instance-attribute

status = CharEnumField(ActorStatus, default=active)

status

ActorGroup

Bases: Model

Groups the actor is a member of

Source code in cattle_grid/account/models.py
class ActorGroup(Model):
    """Groups the actor is a member of"""

    id = fields.IntField(primary_key=True)
    name = fields.CharField(max_length=255)
    """Name of the group"""
    actor: fields.ForeignKeyRelation[ActorForAccount] = fields.ForeignKeyField(
        "ap_models.ActorForAccount", related_name="groups"
    )

name class-attribute instance-attribute

name = CharField(max_length=255)

Name of the group

ActorStatus

Bases: StrEnum

Status actors can have for an account

Source code in cattle_grid/account/models.py
class ActorStatus(StrEnum):
    """Status actors can have for an account"""

    active = auto()
    deleted = auto()