Example #1
0
func getUser() {
	user, err := rights.GetUser(loginName)
	if err != nil {
		fmt.Printf("GetUserError: %s\n", err)
	}
	var buffer bytes.Buffer
	buffer.WriteString("Get User:\n")
	buffer.WriteString(getUserLiterals(user))
	buffer.WriteString("\n")
	fmt.Println(buffer.String())
}
Example #2
0
func newSession(grantors string, servivalSeconds int, w http.ResponseWriter, r *http.Request) (*MySession, error) {
	hmSession := &MySession{}
	err := hmSession.Initialize(grantors, servivalSeconds, w, r)
	if err != nil {
		return nil, err
	}
	user, err := rights.GetUser(grantors)
	if err != nil {
		return nil, err
	}
	go_lib.LogInfof("Set session core attribute '%s' to value '%s' for grantors '%s'. (key=%s)\n", SESSION_GROUP_KEY, user.Group, grantors, hmSession.Key())
	err = hmSession.Set(SESSION_GROUP_KEY, user.Group)
	if err != nil {
		return nil, err
	}
	return hmSession, nil
}