Ejemplo n.º 1
0
    def get(self):
        """Queries whether the caller is authorized to access AuthDB already.

    Response body:
    {
      'topic': <full name of PubSub topic with AuthDB change notifications>,
      'authorized': <true if the caller is allowed to subscribe to it>,
      'gs': {
        'auth_db_gs_path': <same as auth_db_gs_path in SettingsCfg proto>,
        'authorized': <true if the caller should be able to read GS files>
      }
    }
    """
        try:
            return self.send_response({
                'topic':
                pubsub.topic_name(),
                'authorized':
                pubsub.is_authorized_subscriber(self.caller_email()),
                'gs': {
                    'auth_db_gs_path': config.get_settings().auth_db_gs_path,
                    'authorized':
                    gcs.is_authorized_reader(self.caller_email()),
                },
            })
        except (gcs.Error, pubsub.Error) as e:
            self.abort_with_error(409, text=str(e))
Ejemplo n.º 2
0
  def get(self):
    """Queries whether the caller is authorized to attach subscriptions already.

    Response body:
    {
      'topic': <full name of PubSub topic with AuthDB change notifications>,
      'authorized': <boolean>
    }
    """
    try:
      return self.send_response({
        'topic': pubsub.topic_name(),
        'authorized': pubsub.is_authorized_subscriber(self.subscriber_email()),
      })
    except pubsub.Error as e:
      self.abort_with_error(409, text=str(e))
Ejemplo n.º 3
0
  def get(self):
    """Queries whether the caller is authorized to attach subscriptions already.

    Response body:
    {
      'topic': <full name of PubSub topic with AuthDB change notifications>,
      'authorized': <boolean>
    }
    """
    try:
      return self.send_response({
        'topic': pubsub.topic_name(),
        'authorized': pubsub.is_authorized_subscriber(self.subscriber_email()),
      })
    except pubsub.Error as e:
      self.abort_with_error(409, text=str(e))