/usr/lib/python3/dist-packages/social/apps/pyramid_app/models.py is in python3-social-auth 0.2.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | """Pyramid SQLAlchemy ORM models for Social Auth"""
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship, backref
from social.utils import setting_name, module_member
from social.storage.sqlalchemy_orm import SQLAlchemyUserMixin, \
SQLAlchemyAssociationMixin, \
SQLAlchemyNonceMixin, \
SQLAlchemyCodeMixin, \
BaseSQLAlchemyStorage
class PyramidStorage(BaseSQLAlchemyStorage):
user = None
nonce = None
association = None
def init_social(config, Base, session):
if hasattr(config, 'registry'):
config = config.registry.settings
UID_LENGTH = config.get(setting_name('UID_LENGTH'), 255)
User = module_member(config[setting_name('USER_MODEL')])
app_session = session
class _AppSession(object):
@classmethod
def _session(cls):
return app_session
class UserSocialAuth(_AppSession, Base, SQLAlchemyUserMixin):
"""Social Auth association model"""
uid = Column(String(UID_LENGTH))
user_id = Column(Integer, ForeignKey(User.id),
nullable=False, index=True)
user = relationship(User, backref=backref('social_auth',
lazy='dynamic'))
@classmethod
def username_max_length(cls):
return User.__table__.columns.get('username').type.length
@classmethod
def user_model(cls):
return User
class Nonce(_AppSession, Base, SQLAlchemyNonceMixin):
"""One use numbers"""
pass
class Association(_AppSession, Base, SQLAlchemyAssociationMixin):
"""OpenId account association"""
pass
class Code(_AppSession, Base, SQLAlchemyCodeMixin):
pass
# Set the references in the storage class
PyramidStorage.user = UserSocialAuth
PyramidStorage.nonce = Nonce
PyramidStorage.association = Association
PyramidStorage.code = Code
|