Exemple #1
0
func (a *SessionController) InitialSetDatabase() error {
	conn, err := a.prepareconnection()

	if err != nil {
		return err
	}

	err = acl.SetDb(conn)
	if err != nil {
		return err
	}
	return nil
}
Exemple #2
0
func init() {
	conn, err := dbox.NewConnection("mongo",
		&dbox.ConnectionInfo{"localhost:27017", "valegrab", "", "", toolkit.M{}.Set("timeout", 3)})
	if err != nil {
		return
	}
	err = conn.Connect()
	if err != nil {
		return
	}

	err = acl.SetDb(conn)
	if err != nil {
		return
	}
}
Exemple #3
0
func setAclDatabase() (err error) {
	driver, ci := new(colonycore.Login).GetACLConnectionInfo()
	conn, err := dbox.NewConnection(driver, ci)

	if err != nil {
		return
	}

	err = conn.Connect()
	if err != nil {
		return
	}

	if colonycore.GetConfig("default_username") == nil {
		colonycore.SetConfig("default_username", "eaciit")
		colonycore.SetConfig("default_password", "Password.1")
	}

	err = acl.SetDb(conn)
	new(controller.LoginController).PrepareDefaultUser()
	return
}
func (a *ApplicationController) SaveAccess(r *knot.WebContext) interface{} {
	r.Config.OutputType = knot.OutputJson
	conn, err := a.ConnectToDataSource()

	if err != nil {
		return helper.CreateResult(true, nil, err.Error())
	}

	err = acl.SetDb(conn)

	initUser := new(acl.User)

	initUser.LoginID = "alip"
	initUser.FullName = "alip sidik"
	initUser.Email = "*****@*****.**"
	initUser.Password = "******"

	err = acl.Save(initUser)
	if err != nil {
		return helper.CreateResult(true, nil, err.Error())
	}
	return helper.CreateResult(true, conn, "aa")
}