Exemplo n.º 1
0
class Credentials(db.Model):
    """Datastore entity for storing OAuth2.0 credentials.

  The CredentialsProperty is provided by the Google API Python Client, and is
  used by the Storage classes to store OAuth 2.0 credentials in the data store.
  """
    credentials = CredentialsProperty()
Exemplo n.º 2
0
class Utilisateur(db.Model):
    userID = db.StringProperty(required=True)
    calendarID = db.StringProperty(required=True)
    playlistID = db.StringProperty(required=True)
    userEmail = db.StringProperty(required=True)
    credential = CredentialsProperty()
    date_register = db.DateTimeProperty(auto_now=True)
Exemplo n.º 3
0
class UserData(db.Model):
    credentials = CredentialsProperty()
    sections = db.ListProperty(db.Key)

    def getEncodedData(self, articleKeys=None):
        enc = encoder.Encoder()
        # TODO(jimhug): Only return initially visible section in first reply.
        maxSections = min(MAX_SECTIONS, len(self.sections))
        enc.writeInt(maxSections)
        for section in db.get(self.sections[:maxSections]):
            section.encode(enc, articleKeys)
        return enc.getRaw()
Exemplo n.º 4
0
class UserSettings(db.Model):
    """Datastore entity for storing OAuth2.0 credentials.

  The CredentialsProperty is provided by the Google API Python Client, and is
  used by the Storage classes to store OAuth 2.0 credentials in the data store.
  """
    credentials = CredentialsProperty()
    night_mode = db.BooleanProperty(default=False)
    frequency = db.IntegerProperty(default=15)
    timezone_offset = db.IntegerProperty(default=240)

    def to_dict(self):
        return {'nightMode': self.night_mode, 'frequency': self.frequency}
Exemplo n.º 5
0
class Credentials(db.Model):
    """Credentials Datastore class to store user's credentials information.

  Attributes:
    credentials: User's OAuth 2.0 credentials.
    email: User's email.
    user_id: User's ID (also used as key).
  """
    credentials = CredentialsProperty()
    email = db.StringProperty()

    @property
    def user_id(self):
        return self.key().name()
Exemplo n.º 6
0
class SolutionGoogleCredentials(db.Model):
    email = db.StringProperty(indexed=False)
    name = db.StringProperty(indexed=False)
    gender = db.StringProperty(indexed=False)
    picture = db.StringProperty(indexed=False)
    credentials = CredentialsProperty(indexed=False)

    @property
    def id(self):
        return self.key().name()

    @staticmethod
    def createKey(google_id):
        return db.Key.from_path(SolutionGoogleCredentials.kind(), google_id)
Exemplo n.º 7
0
class UserData(db.Model):
    credentials = CredentialsProperty()
    sections = db.ListProperty(db.Key)

    def getEncodedData(self, articles=None, maxSections=5, maxArticles=20):
        enc = encoder.Encoder()
        # TODO(jimhug): Only return initially visible section in first reply.
        if maxSections is None:
            maxSections = len(self.sections)
        else:
            maxSections = min(maxSections, len(self.sections))
        enc.writeInt(maxSections)
        for section in db.get(self.sections[:maxSections]):
            section.encode(enc, maxArticles, articles)
        return enc.getRaw()
Exemplo n.º 8
0
class UserSettings(db.Model):
    """Store user's settings.

  Attributes:
    tasks_credentials: Tasks API scoped credentials.
    email: User's email (also used as key).
    add_to_tasks: Whether or not to automatically add assigned incidents to
        the user's task list.
    task_list_id: ID of the task list to add the incidents to.
  """
    tasks_credentials = CredentialsProperty()
    add_to_tasks = db.BooleanProperty(default=False)
    task_list_id = db.StringProperty(default='@default')

    @property
    def email(self):
        return self.key().name()
Exemplo n.º 9
0
class User(db.Model, Jsonifiable):
    """Represents a PhotoHunt user."""
    jsonkind = 'photohunt#user'
    email = db.EmailProperty()
    google_user_id = db.StringProperty()
    google_display_name = db.StringProperty()
    google_public_profile_url = db.LinkProperty()
    google_public_profile_photo_url = db.LinkProperty()
    google_credentials = CredentialsProperty()

    def json_properties(self):
        """Hide google_credentials from JSON serialization."""
        properties = Jsonifiable.json_properties(self)
        properties.remove('google_credentials')
        return properties

    def get_friends(self):
        """Query the friends of the current user."""
        edges = DirectedUserToUserEdge.all().filter('owner_user_id =',
                                                    self.key().id()).run()
        return db.get(
            [db.Key.from_path('User', edge.friend_user_id) for edge in edges])
Exemplo n.º 10
0
class Credentials(db.Model):
  credentials = CredentialsProperty()
Exemplo n.º 11
0
class CredentialsModel(db.Model):
    # storing credentials object in datastore
    credentials = CredentialsProperty()
Exemplo n.º 12
0
class Credentials(db.Model):
    """Datastore entity for storing OAuth2.0 credentials."""
    credentials = CredentialsProperty()
Exemplo n.º 13
0
class UserCredentials(ndb.Model):
    email = messages.StringField(1, required=True)
    credentials = CredentialsProperty()
Exemplo n.º 14
0
class Credentials(db.Model):
    credentials = CredentialsProperty()
    created = db.DateTimeProperty(auto_now_add=True)
Exemplo n.º 15
0
class Credentials(db.Model):
    """Credentials datastore class to store user's credential information."""
    credentials = CredentialsProperty()
Exemplo n.º 16
0
class Credentials(db.Model):
    credentials = CredentialsProperty()
    created = db.DateTimeProperty(auto_now_add=True)
    updated = db.DateTimeProperty(auto_now=True, required=False)