Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Von einer Anwendung kann geprüft werden, ob es sich bei dem aktuell angemeldeten Nutzer um einen registrierten Administrator für die Anwendung handelt. Ein Administrator ist ein Nutzer, der über die einfache Rolle "Betrachter", "Bearbeiter" oder "Inhaber" oder über die vordefinierte Rolle "App Engine-Anwendungsadministrator" verfügt.
Die Funktion users.is_current_user_admin gibt True zurück, wenn der aktuelle Nutzer ein Administrator für die Anwendung ist.
classAdminPage(webapp2.RequestHandler):defget(self):user=users.get_current_user()ifuser:ifusers.is_current_user_admin():self.response.write('You are an administrator.')else:self.response.write('You are not an administrator.')else:self.response.write('You are not logged in.')
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-03-06 (UTC)."],[[["The application can verify if the logged-in user is an administrator, which includes users with Viewer, Editor, Owner basic roles, or the App Engine App Admin predefined role."],["The `users.is_current_user_admin` function determines if the current user is an administrator, returning `True` if they are and can only be ran in first-generation runtimes in the App Engine standard environment."],["The provided code example demonstrates how to use the `users.is_current_user_admin` function within a web application to determine if a user has administrator privileges."],["The `login: admin` setting in the configuration file can be utilized to easily restrict access to specific parts of the app to administrators only."]]],[]]