core.bones.user =============== .. py:module:: core.bones.user Classes ------- .. autoapisummary:: core.bones.user.UserBone Module Contents --------------- .. py:class:: UserBone(*, creationMagic = False, descr = 'User', format = '$(dest.lastname), $(dest.firstname) ($(dest.name))', kind = 'user', readOnly = False, refKeys = ('key', 'name', 'firstname', 'lastname'), updateMagic = False, visible = None, **kwargs) Bases: :py:obj:`viur.core.bones.relational.RelationalBone` A specialized relational bone for handling user references. Extends the functionality of :class:`viur.core.bones.relational.RelationalBone` to include support for creation and update magic, and comes with a predefined descr, format, kind and refKeys setting. Initializes a new UserBone. :param creationMagic: If True, the bone will automatically store the creating user when a new entry is added. :param updateMagic: If True, the bone will automatically store the last user who updated the entry. :raises ValueError: If the bone is multiple=True and creation/update magic is set. .. py:attribute:: creationMagic :value: False .. py:attribute:: updateMagic :value: False .. py:method:: performMagic(skel, key, isAdd, *args, **kwargs) Perform the magic operation on the bone value. If updateMagic is enabled or creationMagic is enabled and the operation is an addition, the bone will store the current user's key. :param SkeletonInstance skel: The skeleton instance to operate on. :param str key: The key of the bone in the skeleton. :param bool isAdd: If True, the operation is an addition. Otherwise, it is an update. :param args: Additional positional arguments. :param kwargs: Additional keyword arguments. :return: True if the magic operation was successful, False otherwise. :rtype: bool