Exemplo n.º 1
0
    def get_probationers(self):
        """
        Возвращает список испытуемых

        Returns:
            probationers(List): список испытуемых
        """
        probationers = []

        data_store = DataStore("probationers")
        user_manager = UserManager()

        patients_list_data = data_store.get_rows()

        for patients_data in patients_list_data:

            patient = self.probationer_row_to_probationer(patients_data)

            if user_manager.get_user_role(user_manager.get_current_user_id()) == "superuser":
                probationers.append(patient)
            elif patient.user_login == user_manager.get_user_by_id(user_manager.get_current_user_id()).login:
                probationers.append(patient)

        return probationers
    def get_data(self):
        """
        Return main menu structure
        @params:
        """

        user_manager = UserManager()

        menu = config.MAIN_MENU

        curent_user_role = user_manager.get_user_role(
            user_manager.get_current_user_id())

        if curent_user_role == "superuser":
            menu = menu + config.SUPERUSER_MENU

        return menu