access-controller/main/extra_func.py
2021-02-08 20:12:24 +03:00

47 lines
1.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from main.models import UserProfile
# Дополнительные функции
def set_and_get_name(UP: UserProfile): # TODO: Переделать с получением данных через API
"""
Функция устанавливает поле :class:`username` текущим именем в Zendesk
:param UP: Объект профиля пользователя
:type UP: :class:`main.models.UserProfile`
:return: Имя пользователя
"""
return UP.user.username
def set_and_get_email(UP: UserProfile): # TODO: Переделать с получением данных через API
"""
Функция устанавливает поле :class:`user.email` текущей почтой в Zendesk
:param UP: Объект профиля пользователя
:type UP: :class:`main.models.UserProfile`
:return: Почта пользователя
"""
return UP.user.email
def set_and_get_role(UP: UserProfile): # TODO: Переделать с получением данных через API
"""
Функция устанавливает поле :class:`role` текущей ролью в Zendesk
:param UP: Объект профиля пользователя
:type UP: :class:`main.models.UserProfile`
:return: Роль пользователя
"""
return UP.role
def load_and_get_image(UP: UserProfile): # TODO: Переделать с получением изображения через API
"""
Функция загружает и устанавливает изображение в поле :class:`image`
:param UP: Объект профиля пользователя
:type UP: :class:`main.models.UserProfile`
:return: Название изображения
"""
return UP.image.name