sasvi.values
Public chooser-value types for VI user and group references.
VI fields that store a user or group reference (selection type
USER_GROUP) require values shaped as JSON-encoded arrays of
{"id": ..., "type": "user" | "group"} objects. The helpers in this module
let callers pass strongly-typed UserRef / GroupRef instances
(or plain mappings / tuples) and have the SDK do the serialization.
UserRef Objects
@dataclass(frozen=True, slots=True)
class UserRef()
Reference to one VI user account by id.
id
to_dict
def to_dict() -> dict[str, str]
Return the chooser payload for this user reference.
GroupRef Objects
@dataclass(frozen=True, slots=True)
class GroupRef()
Reference to one VI user group by id.
id
to_dict
def to_dict() -> dict[str, str]
Return the chooser payload for this group reference.
UserGroupSelectionType
serialize_user_group_value
def serialize_user_group_value(value: Any) -> object
Serialize one or more user/group references for VI field updates.
VI expects chooser values as a JSON-encoded array string even when a field only contains one user or group.
Arguments:
value- One reference (UserRef,GroupRef, a mapping withidandtype(userorgroup) keys, or an(id, type)tuple), alistof such references, or a pre-serialized string. A tuple is always read as one(id, type)pair, so pass several references as a list. A string that starts with[or{is validated as the JSON array VI stores; any other string, and any other value such asNoneor anint, is returned unchanged for VI to judge.
Returns:
The VI-compatible chooser payload, typically a JSON-encoded array string.
Raises:
ValidationError- When a reference has another shape, or a JSON-shaped string is not a valid JSON array of such references.