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
def _create_guest(self): auth = Instance.get_auth('cityhall', '') auth.create_user('guest', '') auth.grant('auto', 'guest', Rights.Read)
def get(self, request): Instance.create_default_env() self._create_guest() return {'Response': 'Ok'}