Пример #1
0
def get_auth_or_create_guest(request):
    auth_json = request.session.get(SESSION_AUTH, None)
    if auth_json is None:
        auth = Instance.get_auth('guest', '')
        if auth is not None:
            request.session[SESSION_AUTH] = serialize_auth(auth)
    else:
        auth = deserialize_auth(auth_json)
    return auth
Пример #2
0
 def _create_guest(self):
     auth = Instance.get_auth('cityhall', '')
     auth.create_user('guest', '')
     auth.grant('auto', 'guest', Rights.Read)
Пример #3
0
 def get(self, request):
     Instance.create_default_env()
     self._create_guest()
     return {'Response': 'Ok'}