bayesline.api.SharedResource#

pydantic model bayesline.api.SharedResource#

A grant of access to a resource that the current user made to a principal.

permission is the level granted to shared_with, not the current user’s own permission on the resource.

Show JSON schema
{
   "title": "SharedResource",
   "description": "A grant of access to a resource that the current user made to a principal.\n\n``permission`` is the level granted to ``shared_with``, not the current\nuser's own permission on the resource.",
   "type": "object",
   "properties": {
      "resource_type": {
         "$ref": "#/$defs/ResourceType"
      },
      "resource_id": {
         "title": "Resource Id",
         "type": "integer"
      },
      "permission": {
         "$ref": "#/$defs/PermissionLevel"
      },
      "shared_with": {
         "title": "Shared With",
         "type": "string"
      },
      "shared_with_email": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Shared With Email"
      },
      "shared_type": {
         "$ref": "#/$defs/PrincipalType"
      },
      "shared_at": {
         "format": "date-time",
         "title": "Shared At",
         "type": "string"
      },
      "expires_at": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Expires At"
      }
   },
   "$defs": {
      "PermissionLevel": {
         "description": "Permission levels for resource access.",
         "enum": [
            "read",
            "write",
            "delete",
            "admin"
         ],
         "title": "PermissionLevel",
         "type": "string"
      },
      "PrincipalType": {
         "description": "Types of principals that can be granted permissions.",
         "enum": [
            "user",
            "group",
            "role"
         ],
         "title": "PrincipalType",
         "type": "string"
      },
      "ResourceType": {
         "description": "Types of resources that can be protected by ACL.",
         "enum": [
            "setting"
         ],
         "title": "ResourceType",
         "type": "string"
      }
   },
   "required": [
      "resource_type",
      "resource_id",
      "permission",
      "shared_with",
      "shared_type",
      "shared_at"
   ]
}

Config:
  • frozen: bool = True

Fields:
  • expires_at (datetime.datetime | None)

  • permission (bayesline.api._src.acl_models.PermissionLevel)

  • resource_id (int)

  • resource_type (bayesline.api._src.acl_models.ResourceType)

  • shared_at (datetime.datetime)

  • shared_type (bayesline.api._src.acl_models.PrincipalType)

  • shared_with (str)

  • shared_with_email (str | None)

field resource_type: ResourceType [Required]#
field resource_id: int [Required]#
field permission: PermissionLevel [Required]#
field shared_with: str [Required]#
field shared_with_email: str | None = None#
field shared_type: PrincipalType [Required]#
field shared_at: datetime [Required]#
field expires_at: datetime | None = None#