Managing
The managing module enables managing actors through the message queue. Through this application relying on cattle_grid to handle ActivityPub traffic, can create and update user.
cattle_grid.manage
router_configuration = [RoutingKeyConfig('create_actor', create_actor), RoutingKeyConfig('update_actor', update_actor)]
module-attribute
Router configuration
RoutingKeyConfig
dataclass
Describes a routingkey to coroutine relation
Source code in cattle_grid/manage/__init__.py
handler: Coroutine
instance-attribute
The coroutine that handles the message
routing_key: str
instance-attribute
The routing key to be used
create_router(config)
Creates a router to be used to manage users
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ManageConfig
|
|
required |
Returns:
| Type | Description |
|---|---|
RabbitRouter
|
|
Source code in cattle_grid/manage/__init__.py
cattle_grid.config.ManageConfig
Bases: BaseModel
Configures managing
Source code in cattle_grid/config/__init__.py
enable: bool = False
class-attribute
instance-attribute
Set to true to enable
exchange: str = 'manage'
class-attribute
instance-attribute
RabbitMQ exchange name
cattle_grid.manage.models
CreateActorMessage
Bases: BaseModel
Source code in cattle_grid/manage/models.py
autoFollow: Optional[bool] = None
class-attribute
instance-attribute
Enables setting actors to automatically accept follow requests
baseUrl: str
instance-attribute
base url used to create the user on. Can contain a path
preferredUsername: Optional[str] = None
class-attribute
instance-attribute
Add a preferred username. This name will be used in acct:username@domain and supplied to webfinger. Here domain is determine from baseUrl.
profile: Optional[Dict[str, Any]] = {}
class-attribute
instance-attribute
New profile object for the actor. The fields.
CreateActorResult
UpdateActorMessage
Bases: BaseModel
Allows one to update the actor object
Source code in cattle_grid/manage/models.py
actor: str
instance-attribute
The URI of the actor being updated. Must be managed by cattle_grid
autoFollow: Optional[bool] = None
class-attribute
instance-attribute
Enables setting actors to automatically accept follow requests
profile: Optional[Dict[str, Any]] = None
class-attribute
instance-attribute
New profile object for the actor. The fields.
Json Schema
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
"CreateActorMessage": {
"type": "object",
"additionalProperties": false,
"title": "Create Actor Message",
"description": "",
"properties": {
"baseUrl": {
"type": "string",
"description": "base url used to create the user on. Can contain a path"
},
"preferredUsername": {
"type": "string",
"description": "Add a preferred username. This name will be used in acct:username@domain and supplied to webfinger. Here domain is determine from baseUrl."
},
"profile": {
"type": "object",
"description": "New profile object for the actor. The fields.",
"default": {}
},
"autoFollow": {
"type": "boolean",
"description": "Enables setting actors to automatically accept follow requests"
}
},
"required": ["baseUrl"]
},
"CreateActorResult": {
"type": "object",
"additionalProperties": false,
"title": "Create Actor Result",
"description": "",
"properties": {
"actor": {
"type": "object",
"description": "The actor that was created"
}
},
"required": ["actor"]
},
"UpdateActorMessage": {
"type": "object",
"additionalProperties": false,
"title": "Update Actor Message",
"description": "Allows one to update the actor object",
"properties": {
"actor": {
"type": "string",
"description": "The URI of the actor being updated. Must be managed by cattle_grid"
},
"profile": {
"type": "object",
"description": "New profile object for the actor. The fields."
},
"autoFollow": {
"type": "boolean",
"description": "Enables setting actors to automatically accept follow requests"
}
},
"required": ["actor"]
}
}
}