bayesline.api.SharedResourceSummary#
- pydantic model bayesline.api.SharedResourceSummary#
Summary of the resources that are shared with others.
Show JSON schema
{ "title": "SharedResourceSummary", "description": "Summary of the resources that are shared with others.", "type": "object", "properties": { "resources": { "items": { "$ref": "#/$defs/SharedResource" }, "title": "Resources", "type": "array" } }, "$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" }, "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.", "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" } }, "required": [ "resource_type", "resource_id", "permission", "shared_with", "shared_type", "shared_at" ], "title": "SharedResource", "type": "object" } }, "required": [ "resources" ] }
- Config:
frozen: bool = True
- Fields:
resources (collections.abc.Sequence[bayesline.api._src.acl_models.SharedResource])
-
field resources:
Sequence[SharedResource] [Required]#
- get_resources(*, shared_with: str, shared_type: PrincipalType) → Sequence[SharedResource]#
Get the resources that are shared with a specific principal.
Parameters#
- shared_withstr
The user id, group name or role name that resources are shared with.
- shared_typePrincipalType
The type of the principal that resources are shared with.
Returns#
- Sequence[SharedResource]
The resources that are shared with the specified principal. Might be empty if no resources are shared with that principal.
- get_users() → Sequence[str]#
Get the ids of the users that resources are shared with.
Returns#
- Sequence[str]
The distinct user ids, sorted.