Python 2.7은 지원이 종료되었으며 2026년 1월 31일에 지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 Python 2.7 애플리케이션을 배포할 수 없습니다. 기존 Python 2.7 애플리케이션은 지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다. 지원되는 최신 Python 버전으로 마이그레이션하는 것이 좋습니다.
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.')
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThe 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.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eusers.is_current_user_admin\u003c/code\u003e function determines if the current user is an administrator, returning \u003ccode\u003eTrue\u003c/code\u003e if they are and can only be ran in first-generation runtimes in the App Engine standard environment.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code example demonstrates how to use the \u003ccode\u003eusers.is_current_user_admin\u003c/code\u003e function within a web application to determine if a user has administrator privileges.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003elogin: admin\u003c/code\u003e setting in the configuration file can be utilized to easily restrict access to specific parts of the app to administrators only.\u003c/p\u003e\n"]]],[],null,["# Admin Users\n\nAn application can test whether the currently signed-in user is a registered administrator for\nthe application. An administrator is a user who has the Viewer, Editor, or Owner basic\nrole, or the App Engine App Admin predefined role.\n| This page describes how to use the legacy bundled services and APIs. This API can only run in first-generation runtimes in the App Engine standard environment. If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\nThe function [users.is_current_user_admin](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/users#is_current_user_admin)\nreturns `True` if the current user is an administrator for the application. \n\n class AdminPage(webapp2.RequestHandler):\n def get(self):\n user = users.get_current_user()\n if user:\n if users.is_current_user_admin():\n self.response.write('You are an administrator.')\n else:\n self.response.write('You are not an administrator.')\n else:\n self.response.write('You are not logged in.')\n\n| **Tip:** An easy way to restrict access to a part of your application to administrators is to use the `login: admin` configuration element for the URL handler. See [Configuring an App](/appengine/docs/legacy/standard/python/config/appref#handlers_login)"]]