<s> """<STR_LIT>""" <EOL> import logging <EOL> import feconf <EOL> import utils <EOL> from google . appengine . api import users <EOL> from google . appengine . ext import ndb <EOL> def create_login_url ( slug ) : <EOL> """<STR_LIT>""" <EOL> return users . create_login_url ( utils . set_url_query_parameter ( <EOL> feconf . SIGNUP_URL , '<STR_LIT>' , slug ) ) <EOL> def create_logout_url ( slug ) : <EOL> """<STR_LIT>""" <EOL> logout_url = utils . set_url_query_parameter ( '<STR_LIT>' , '<STR_LIT>' , slug ) <EOL> return logout_url <EOL> def get_current_user ( ) : <EOL> """<STR_LIT>""" <EOL> return users . get_current_user ( ) <EOL> def is_current_user_super_admin ( ) : <EOL> """<STR_LIT>""" <EOL> return users . is_current_user_admin ( ) <EOL> def get_user_id_from_email ( email ) : <EOL> """<STR_LIT>""" <EOL> class _FakeUser ( ndb . Model ) : <EOL> _use_memcache = False <EOL> _use_cache = False <EOL> user = ndb . UserProperty ( required = True ) <EOL> try : <EOL> fake_user = users . User ( email ) <EOL> except users . UserNotFoundError : <EOL> logging . error ( <EOL> '<STR_LIT>' <EOL> % email ) <EOL> return None <EOL> key = _FakeUser ( id = email , user = fake_user ) . put ( ) <EOL> obj = _FakeUser . get_by_id ( key . id ( ) ) <EOL> user_id = obj . user . user_id ( ) <EOL> if user_id : <EOL> return unicode ( user_id ) <EOL> else : <EOL> return None <EOL> def get_user_id ( user ) : <EOL> """<STR_LIT>""" <EOL> return user . user_id ( ) <EOL> def get_user_email ( user ) : <EOL> """<STR_LIT>""" <EOL> return user . email ( ) </s>
