Exemple #1
0
func (self *MySession) Destroy() (bool, error) {
	if len(self.key) == 0 || len(self.sessionId) == 0 {
		errorMsg := fmt.Sprintln("Uninitialized yet!")
		return false, errors.New(errorMsg)
	}
	go_lib.LogInfof("Destroy session (key=%s)... \n", self.key)
	grantors, err := dao.GetHash(self.key, SESSION_GRANTORS_KEY)
	if err != nil {
		return false, err
	}
	_, err = dao.DelKey(self.key)
	if err != nil {
		return false, err
	}
	if len(grantors) > 0 {
		_, err = dao.DelHashField(SESSION_MAP_KEY, grantors)
		if err != nil {
			return false, err
		}
	}
	go_lib.LogInfof("Delete session cookie (value=%s)...\n", self.sessionId)
	hmSessionCookie.Delete(SESSION_COOKIE_KEY, self.w)
	go_lib.LogInfof("The session (key=%s) is destroyed. \n", self.key)
	return true, nil
}
Exemple #2
0
func DeleteUserGroup(groupName string) error {
	if len(groupName) == 0 {
		return errors.New("The parameter named groupName is EMPTY!")
	}
	_, err := dao.DelHashField(dao.USER_GROUP_KEY, groupName)
	if err != nil {
		return err
	}
	return nil
}
Exemple #3
0
func (self *MySession) Delete(name string) error {
	if len(name) == 0 {
		errorMsg := fmt.Sprintln("The parameter named name is EMPTY!")
		return errors.New(errorMsg)
	}
	_, err := dao.DelHashField(self.key, name)
	if err != nil {
		return err
	}
	return nil
}