-
-
Notifications
You must be signed in to change notification settings - Fork 2
incendium.vision.gui.authorization
César Román edited this page Apr 30, 2024
·
2 revisions
Open up a popup input dialog box.
This dialog box will show a prompt message, and allow the user to type in their
username and password. When the user is done, they can press "OK" or "Cancel".
If "OK" is pressed, this function will attempt to validate the User credentials
against the Authentication Profile and verify if the User belongs to the role
.
If "Cancel" is pressed, this function will return False
.
incendium.vision.gui.authorization(role, [auth_profile], [title], [username_label_text], [password_label_text])
Args:
- role (
str
): Required role. - auth_profile (
str
): The name of the authentication profile to run against. Leaving this out will use the project's default profile. Optional. - title (
str
): A title for the input box. This will be translated to the selected Locale. Defaults to "Authentication". Optional. - username_label_text (
str
): The text to display for the username label. This will be translated to the selected Locale. Optional. Defaults to "Username". - password_label_text: The text to display for the password label. This will be translated to the selected Locale. Optional. Defaults to "Password".
Returns:
-
bool
:True
if the user was validated,False
otherwise.
None.
from incendium.vision import gui
def important_task():
pass
if gui.authorization("Important Role"):
important_task()
else:
gui.error("Access denied.")