Example #1
0
def do_init():
    create_all()
    project1 = model.session.query(RowProject).first()
    if project1 is None:
        print "No projects found. Creating a 'llampex' project"
        project1 = RowProject()
        project1.code = "llampex"
        project1.description = "Llampex main project"
        project1.db = "llampex"
        project1.path = os.path.realpath(filedir("../"))
        project1.active = True
        model.session.add(project1)
        model.session.commit()
        
    user1 = model.session.query(RowUser).first()
    if user1 is None:
        print "No users found. Creating a 'llampex' user with password 'llampex'"
        user1 = RowUser()
        user1.username = "******"
        user1.password = compute_password("llampex")
        model.session.add(user1)
        model.session.commit()
        for project in model.session.query(RowProject):
            nn = RowProjectUser()
            nn.user = user1
            nn.project = project
            model.session.add(nn)
            
            user1.projects.append(nn)
        model.session.commit()
Example #2
0
 def newUser(self, username, password, active, admin):
     user = RowUser()
     user.username = username
     user.password = compute_password(password)
     user.active = active
     user.admin = admin
         
     model.session.add(user)
     return self.do_Commit()
Example #3
0
def do_adduser(username = None, password = None):
    if username is None:
        username = raw_input("Please give an username: "******"No password given, placing the same username as password."
        password = username
    user1 = RowUser()
    user1.username = username
    user1.password = compute_password(password)
    model.session.add(user1)
    model.session.commit()
    print "Username %s added. To change the password use 'passwd' command" % (
        repr(user1.username))
Example #4
0
    def newUser(self, username, password, active, admin):
        user = RowUser()
        user.username = username
        user.password = compute_password(password)
        user.active = active
        user.admin = admin

        model.session.add(user)
        return self.do_Commit()