'update( self, trans, id, payload, **kwd )
* PUT /api/users/{id}
updates the values for the item with the given ``id``
:type id: str
:param id: the encoded id of the item to update
:type payload: dict
:param payload: a dictionary of new attribute values
:rtype: dict
:returns: an error object if an error occurred or a dictionary containing
the serialized item after any changes'

@expose_api
def update(self, trans, id, payload, **kwd):

    current_user = trans.user
    user_to_update = self.user_manager.by_id(self.decode_id(id))
    editing_someone_else = (current_user != user_to_update)
    is_admin = (trans.api_inherit_admin or self.user_manager.is_admin(current_user))
    if (editing_someone_else and (not is_admin)):
        raise exceptions.InsufficientPermissionsException('you    are    not    allowed    to    update    that    user', id=id)
    self.user_deserializer.deserialize(user_to_update, payload, user=current_user, trans=trans)
    return self.user_serializer.serialize_to_view(user_to_update, view='detailed')
