Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authorization for submission access #2276

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

FredLL-Avaiga
Copy link
Member

resolves taipy-enterprise#562

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Authorization for submission access

Related Tickets & Documents

  • Closes taipy-enterprise#562

How to reproduce the issue

from taipy import Config
import taipy as tp
from taipy.gui import Gui, notify
from taipy.gui import Gui
from taipy.auth import hash_taipy_password
from taipy.gui import State, navigate
import taipy.enterprise.gui as tp_enterprise
import os
from taipy import Config


os.environ["TAIPY_AUTH_HASH"] = "taipy"


passwords = {
    "florian": hash_taipy_password("florian"),
}

roles = {
    "florian": {"admin", "TAIPY_ADMIN"},
}

Config.configure_job_executions(mode="standalone", max_nb_of_workers=2)
Config.configure_authentication("taipy", passwords=passwords, roles=roles)


def on_login(state: State, id, login_args):
    username, password = "florian", "florian"
    credentials = tp_enterprise.login(state, username, password)
    print(credentials.roles)
    navigate(state, "Home", force=True)


# Normal function used by Taipy
def double(nb):
    return nb * 2


# Configuration of Data Nodes
input_cfg = Config.configure_data_node("input_dn", default_data=21)
output_cfg = Config.configure_data_node("output_dn")


# Configuration of tasks
first_task_cfg = Config.configure_task("double", double, input_cfg, output_cfg)


# Configuration of scenario
scenario_cfg = Config.configure_scenario(
    id="my_scenario",
    task_configs=[
        first_task_cfg,
    ],
    name="my_scenario",
)

if __name__ == "__main__":
    tp.Orchestrator().run()

    scenario_1 = None

    scenario_md = """
<|{scenario_1}|scenario_selector|>
<|{scenario_1}|scenario|>
"""

    pages = {
        "/": "<|navbar|>",
        "login": "<|Login|login|>",
        "Home": scenario_md,
    }

    Gui(pages=pages).run()

Other branches or releases that this needs to be backported

Describe which projects this change will impact and that needs to be backported.

Checklist

  • Does this solution meet the acceptance criteria of the related issue?
  • Is the related issue checklist completed?
  • Does this PR adds unit tests for the developed code? If not, why?
  • End-to-End tests have been added or updated?
  • Was the documentation updated, or a dedicated issue for documentation created? (If applicable)
  • Is the release notes updated? (If applicable)

resolves taipy-enterprise#562
@FredLL-Avaiga FredLL-Avaiga added Core Related to Taipy Core 🟥 Priority: Critical Must be addressed as soon as possible 💥Malfunction Addresses an identified problem. Gui: Back-End labels Nov 25, 2024
@FredLL-Avaiga FredLL-Avaiga self-assigned this Nov 25, 2024
Fred Lefévère-Laoide added 3 commits November 25, 2024 10:15
Copy link
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
19341 16815 87% 0% 🟢

New Files

File Coverage Status
taipy/gui_core/_utils.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
taipy/gui_core/_context.py 57% 🟢
TOTAL 57% 🟢

updated for commit: 26861c7 by action🐍

Copy link
Member

@FabienLelaquais FabienLelaquais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Related to Taipy Core Gui: Back-End 💥Malfunction Addresses an identified problem. 🟥 Priority: Critical Must be addressed as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants