Ejemplo n.º 1
0
def create_editor(name, password, email):
    user = User.create_user(name, email, password)
    profile = UserProfile()
    profile.save()
    user.profile = profile
    role = Role.query.filter_by(name='editor').first()
    if not role:
        role = Role('editor', 'editor role')
        role.save()
    user.roles.append(role)
    user.save()
Ejemplo n.º 2
0
def create_editor(name, password, email):
    user = User.create_user(name, email, password)
    profile = UserProfile()
    profile.save()
    user.profile = profile
    role = Role.query.filter_by(name='editor').first()
    if not role:
        role = Role('editor', 'editor role')
        role.save()
    user.roles.append(role)
    user.save()
Ejemplo n.º 3
0
def create_admin(name, password, email):
    user = User.create_user(name, email, password)
    profile = UserProfile()
    profile.save()
    user.profile = profile
    role = Role.query.filter_by(name="admin").first()
    if not role:
        role = Role("admin", "admin role")
        role.save()
    user.roles.append(role)
    role = Role.query.filter_by(name="editor").first()
    if not role:
        role = Role("editor", "editor role")
        role.save()
    user.roles.append(role)
    user.save()
Ejemplo n.º 4
0
def create_admin(name, password, email):
    user = User.create_user(name, email, password)
    profile = UserProfile()
    profile.save()
    user.profile = profile
    user.save()
    role = Role.query.filter_by(name='admin').first()
    if not role:
        role = Role()
        role.name = 'admin'
        role.description = 'admin role'
        role.save()
    user.roles.append(role)
    role = Role.query.filter_by(name='editor').first()
    if not role:
        role = Role()
        role.name = 'editor'
        role.description = 'editor role'
        role.save()
    user.roles.append(role)
    user.save()
Ejemplo n.º 5
0
def create_admin(name, password, email):
    user = User.create_user(name, email, password)
    profile = UserProfile()
    profile.save()
    user.profile = profile
    user.save()
    role = Role.query.filter_by(name='admin').first()
    if not role:
        role = Role()
        role.name = 'admin'
        role.description = 'admin role'
        role.save()
    user.roles.append(role)
    role = Role.query.filter_by(name='editor').first()
    if not role:
        role = Role()
        role.name = 'editor'
        role.description = 'editor role'
        role.save()
    user.roles.append(role)
    user.save()
Ejemplo n.º 6
0
def create_common_user(name, password, email):
    user = User.create_user(name, email, password)
    profile = UserProfile()
    profile.save()
    user.profile = profile
    user.save()
Ejemplo n.º 7
0
def authenticate(username, password):
    from youjiao.user.models import User
    user = User.verify(username, password)
    return user if user else None
Ejemplo n.º 8
0
def authenticate(username, password):
    from youjiao.user.models import User
    user = User.verify(username, password)
    return user if user else None
Ejemplo n.º 9
0
def create_common_user(name, password, email):
    user = User.create_user(name, email, password)
    profile = UserProfile()
    profile.save()
    user.profile = profile
    user.save()