Esempio n. 1
0
    def from_sql(cls, model):
        user = cls()
        session = db.create_scoped_session()
        model = session.query(User).get(model.id)

        user.objectClass = [
            'top', 'account', 'simpleSecurityObject', 'xxPilot'
        ]
        user.email = model.email
        user.accountStatus = model.status
        if model.main_character:
            user.characterName = model.main_character.name
            user.alliance = model.main_character.alliance_name
            user.corporation = model.main_character.corporation_name
        else:
            user.characterName = ''
            user.alliance = ''
            user.corporation = ''
        user.authGroup = [
            membership.group.name
            for membership in model.groups.filter_by(is_applying=False)
        ]
        user.dn = 'uid={},{}'.format(model.user_id,
                                     current_app.config['SYNC_LDAP_MEMBERDN'])
        return user
Esempio n. 2
0
File: user.py Progetto: J4LP/newauth
    def update_with_model(self, model):
        session = db.create_scoped_session()
        model = session.query(User).get(model.id)

        self.objectClass = ['top', 'account', 'simpleSecurityObject', 'xxPilot']
        self.email = model.email
        self.accountStatus = model.status
        if model.main_character:
            self.characterName = model.main_character.name
            self.alliance = model.main_character.alliance_name
            self.corporation = model.main_character.corporation_name
        else:
            self.characterName = ''
            self.alliance = ''
            self.corporation = ''
        self.authGroup = [membership.group.name for membership in model.groups.filter_by(is_applying=False)]
Esempio n. 3
0
File: user.py Progetto: J4LP/newauth
    def from_sql(cls, model):
        user = cls()
        session = db.create_scoped_session()
        model = session.query(User).get(model.id)

        user.objectClass = ['top', 'account', 'simpleSecurityObject', 'xxPilot']
        user.email = model.email
        user.accountStatus = model.status
        if model.main_character:
            user.characterName = model.main_character.name
            user.alliance = model.main_character.alliance_name
            user.corporation = model.main_character.corporation_name
        else:
            user.characterName = ''
            user.alliance = ''
            user.corporation = ''
        user.authGroup = [membership.group.name for membership in model.groups.filter_by(is_applying=False)]
        user.dn = 'uid={},{}'.format(model.user_id, current_app.config['SYNC_LDAP_MEMBERDN'])
        return user
Esempio n. 4
0
    def update_with_model(self, model):
        session = db.create_scoped_session()
        model = session.query(User).get(model.id)

        self.objectClass = [
            'top', 'account', 'simpleSecurityObject', 'xxPilot'
        ]
        self.email = model.email
        self.accountStatus = model.status
        if model.main_character:
            self.characterName = model.main_character.name
            self.alliance = model.main_character.alliance_name
            self.corporation = model.main_character.corporation_name
        else:
            self.characterName = ''
            self.alliance = ''
            self.corporation = ''
        self.authGroup = [
            membership.group.name
            for membership in model.groups.filter_by(is_applying=False)
        ]
Esempio n. 5
0
 def update_groups(self, model):
     session = db.create_scoped_session()
     redis.set('newauth_ipb_groups', json.dumps([
         group.name for group in session.query(Group).all()
     ]))
Esempio n. 6
0
 def update_contacts(self, model):
     session = db.create_scoped_session()
     redis.set('newauth_ipb_contacts', json.dumps([
         contact.name for contact in session.query(AuthContact).all()
     ]))
Esempio n. 7
0
 def update_membership(self, model):
     session = db.create_scoped_session()
     user = session.query(User).get(model.user_id)
     ldap_user = self.get_user(user.user_id)
     ldap_user.update_with_model(user)
     self.save_user(ldap_user)