Beispiel #1
0
func (this *AllocSafeRoleAction) Post() {
	reqMsg := &AllocSafeRoleRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	unAllocSql := "delete from fast.roleAlloc where roleId=$1 and userId=$2"
	allocSql := "insert into fast.roleAlloc values($1,$2)"

	unAllocStmt, err := db.Prepare(unAllocSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.UnAllocs {
		unAllocStmt.Exec(v.RoleId, v.UserId)
	}
	unAllocStmt.Close()

	allocStmt, err := db.Prepare(allocSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.Allocs {
		allocStmt.Exec(v.RoleId, v.UserId)
	}
	allocStmt.Close()

	rspMsg := &AllocSafeRoleResponse{}
	rspMsg.Init(reqMsg)

	this.SendJson(rspMsg)
}
Beispiel #2
0
func (this *ChangeSafeRoleAction) Post() {
	reqMsg := &ChangeSafeRoleRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	changeSql := "update fast.safeRole set name=$1,roleDetail=$2,roleRemark=$3," +
		"isUser=$4,isDepart=$5,defaultSafeObject=$6 where id=$7"

	changeStmt, err := db.Prepare(changeSql)
	utils.VerifyErr(err)
	changeStmt.Exec(
		reqMsg.Name,
		reqMsg.RoleDetail,
		reqMsg.RoleRemark,
		reqMsg.IsUser,
		reqMsg.IsDepart,
		reqMsg.DefaultSafeObject,
		reqMsg.Id)
	changeStmt.Close()

	rspMsg := &ChangeSafeRoleResponse{}
	rspMsg.Init(reqMsg)
	rspMsg.SafeRole = reqMsg.SafeRole

	WriteLog(rspMsg, reqMsg.Name, comm.NULL_STR)
	this.SendJson(rspMsg)
}
Beispiel #3
0
func (this *QueryAllocSafeRoleAction) Post() {
	reqMsg := &QueryAllocSafeRoleRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	querySql := "select distinct * from fast.roleAlloc"

	allocRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	rspMsg := &QueryAllocSafeRoleResponse{}

	for allocRows.Next() {
		alloc := RoleAllocInfo{}
		allocRows.Scan(&alloc.RoleId, &alloc.UserId)
		rspMsg.Allocs = append(rspMsg.Allocs, alloc)
	}

	rspMsg.Init(reqMsg)
	this.SendJson(rspMsg)
}
Beispiel #4
0
func (this *DeleteSafeRoleAction) Post() {
	reqMsg := &DeleteSafeRoleRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	reqMsg.RoleId = strings.TrimSpace(reqMsg.RoleId)

	rspMsg := &DeleteSafeRoleResponse{}
	rspMsg.Init(reqMsg)
	if reqMsg.RoleId == comm.NULL_STR {
		this.SendJson(rspMsg)
		return
	}

	db := ds.DB()
	defer db.Close()

	delRoleSql := "delete from fast.safeRole where "
	delRoleSql += "id='" + reqMsg.RoleId + "'"

	delRoleStmt, err := db.Prepare(delRoleSql)
	utils.VerifyErr(err)
	delRoleStmt.Exec()
	delRoleStmt.Close()

	WriteLog(rspMsg, reqMsg.RoleId, comm.NULL_STR)
	this.SendJson(rspMsg)
}
Beispiel #5
0
func (this *SafeOperateAuthAction) Post() {

	reqMsg := &SafeOperateAuthRequest{}
	this.GetReqJson(reqMsg)

	db := ds.DB()
	defer db.Close()

	unAuthSql := "delete from fast.operateAuth where operateId=$1 and roleId=$2"
	authSql := "insert into fast.operateAuth values($1,$2)"

	unAuthStmt, err := db.Prepare(unAuthSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.UnAuths {
		unAuthStmt.Exec(v.OperateId, v.RoleId)
	}
	unAuthStmt.Close()

	authStmt, err := db.Prepare(authSql)
	utils.VerifyErr(err)
	for _, v := range reqMsg.Auths {
		authStmt.Exec(v.OperateId, v.RoleId)
	}
	authStmt.Close()

	rspMsg := &SafeOperateAuthResponse{}
	rspMsg.Init(reqMsg)

	this.SendJson(rspMsg)

}
Beispiel #6
0
func (this *fastSysParaMgr) ChangePara(paraName, paraValue string) {
	paraName = strings.TrimSpace(paraName)
	paraValue = strings.TrimSpace(paraValue)
	if paraName == comm.NULL_STR || paraValue == comm.NULL_STR {
		return
	}

	para, ok := this.mapPara[paraName]
	if !ok {
		return
	}

	para.ParaValue = paraValue

	db := ds.DB()
	defer db.Close()

	changeSql := "update fast.sysParaConf set paraValue=$1 where paraName=$2"

	changeStmt, err := db.Prepare(changeSql)
	VerifyErr(err)
	changeStmt.Exec(paraValue, paraName)
	changeStmt.Close()

	return
}
Beispiel #7
0
func (this *FastSysParaAgent) getDatas() []utils.FastSysPara {

	paras := []utils.FastSysPara{}

	db := ds.DB()
	defer db.Close()

	querySql := "select * from fast.sysParaConf"

	rows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for rows.Next() {
		newPara := utils.FastSysPara{}
		err = rows.Scan(
			&newPara.Catalog,
			&newPara.ParaName,
			&newPara.ParaValue,
			&newPara.ParaType,
			&newPara.ParaRemark)
		paras = append(paras, newPara)
	}

	return paras
}
Beispiel #8
0
func (this *UnLockUserAction) Post() {
	reqMsg := &UnLockUserRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	reqMsg.UserId = strings.TrimSpace(reqMsg.UserId)
	rspMsg := &UnLockUserResponse{}
	rspMsg.Init(reqMsg)
	if reqMsg.UserId == comm.NULL_STR {
		this.SendJson(rspMsg)
		return
	}

	db := ds.DB()
	defer db.Close()

	unLockUserSql := "update fast.safeUser set isLock=$1, lockReason=$2 where id=$3"

	unLockUserStmt, err := db.Prepare(unLockUserSql)
	utils.VerifyErr(err)
	unLockUserStmt.Exec(false, comm.NULL_STR, reqMsg.UserId)
	unLockUserStmt.Close()

	rspMsg.Init(reqMsg)
	this.SendJson(rspMsg)

}
Beispiel #9
0
func (this *SafeOperateAgent) getDatas() []SafeOperate {
	datas := []SafeOperate{}

	db := ds.DB()
	defer db.Close()

	operateSql := "select * from fast.safeOperate where 1=1"
	operateRows, err := db.Query(operateSql)
	utils.VerifyErr(err)

	for operateRows.Next() {
		operate := SafeOperate{}
		operateRows.Scan(
			&operate.Id,
			&operate.SerialId,
			&operate.OperateCode,
			&operate.Subsys,
			&operate.OperateGroup,
			&operate.OperateName,
			&operate.OperateDetail,
			&operate.OperateRemark,
			&operate.IsAuth,
			&operate.IsLog)

		operate.Departs = []string{}
		operate.Users = []string{}
		operate.Roles = []string{}

		datas = append(datas, operate)
	}

	return datas
}
Beispiel #10
0
func (this *ModPasswordAction) Post() {
	reqMsg := &ModPasswordRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	reqMsg.UserId = strings.TrimSpace(reqMsg.UserId)
	reqMsg.NewPassword = strings.TrimSpace(reqMsg.NewPassword)

	rspMsg := &DeleteUserResponse{}
	rspMsg.Init(reqMsg)
	if reqMsg.UserId == comm.NULL_STR || reqMsg.NewPassword == comm.NULL_STR {
		this.SendJson(rspMsg)
		return
	}

	db := ds.DB()
	defer db.Close()

	modPasswordSql := "update fast.safeUser set password=$1 where id=$2"

	modPasswordStmt, err := db.Prepare(modPasswordSql)
	utils.VerifyErr(err)
	modPasswordStmt.Exec(reqMsg.NewPassword, reqMsg.UserId)
	modPasswordStmt.Close()

	rspMsg.Init(reqMsg)
	this.SendJson(rspMsg)

}
Beispiel #11
0
func (this *safeObjectMgrImpl) CreateObject(safeObj *SafeObject) (msgId string, ok bool) {
	msgId = comm.NULL_STR
	ok = false

	if safeObj == nil {
		return
	}

	db := ds.DB()
	defer db.Close()

	createSql := "insert into fast.safeObject values($1,$2,$3,$4,$5,$6,$7,$8)"
	createStmt, err := db.Prepare(createSql)
	utils.VerifyErr(err)

	createStmt.Exec(
		safeObj.Id,
		safeObj.SerialId,
		safeObj.ObjectType,
		safeObj.ParentPath,
		safeObj.ObjectName,
		safeObj.ObjectText,
		safeObj.ObjectImage,
		safeObj.ObjectRemark)
	createStmt.Close()

	msgId = msg.MSG_SUCCESS
	ok = true

	return
}
Beispiel #12
0
func (this *logMgrImpl) WriteRawLog(log *OperateLog) {

	if log == nil {
		return
	}

	if log.IsEmpty() {
		return
	}

	db := ds.DB()
	defer db.Close()

	logSql := "insert into fast.operateLog values($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13)"
	logStmt, err := db.Prepare(logSql)
	utils.VerifyErr(err)
	logStmt.Exec(
		log.UserName,
		log.Subsys,
		log.OperateGroup,
		log.OperateName,
		log.OperateRet,
		log.OperateRetDetail,
		log.OperateObj,
		log.OperateContent,
		log.UserIpAddress,
		log.UserHostName,
		log.OperateTime,
		log.LogType,
		log.SerialNum)
	logStmt.Close()
}
Beispiel #13
0
func (this *operateMgrImpl) init() {
	fmt.Println("  Init Operate Mgr")

	this.mapOperate = map[string](*SafeOperate){}

	db := ds.DB()
	defer db.Close()

	querySql := "select * from fast.safeOperate"
	operateRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for operateRows.Next() {
		operate := &SafeOperate{}
		operateRows.Scan(
			&operate.Id,
			&operate.SerialId,
			&operate.OperateCode,
			&operate.Subsys,
			&operate.OperateGroup,
			&operate.OperateName,
			&operate.OperateDetail,
			&operate.OperateRemark,
			&operate.IsAuth,
			&operate.IsLog)
		this.mapOperate[operate.OperateCode] = operate
	}

}
Beispiel #14
0
func (this *safeObjectMgrImpl) QueryAuthsByType(objectType string) (objects []ObjectAuthInfo) {
	objects = []ObjectAuthInfo{}

	db := ds.DB()
	defer db.Close()

	objectType = strings.TrimSpace(objectType)

	querySql := "select distinct objectAuth.* from fast.objectAuth"
	if objectType != comm.NULL_STR {
		querySql += ",fast.safeObject where objectAuth.objectId=safeObject.id "
		querySql += " and safeObject.objectType='" + objectType + "'"
	}

	authRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for authRows.Next() {
		auth := ObjectAuthInfo{}
		authRows.Scan(&auth.ObjectId, &auth.RoleId)
		objects = append(objects, auth)
	}

	return
}
Beispiel #15
0
func (this *safeObjectMgrImpl) QueryObjectsByType(objectType string) (objects []SafeObject) {
	objects = [](SafeObject){}
	objectType = strings.TrimSpace(objectType)

	querySql := "select distinct * from fast.safeObject"
	if objectType != comm.NULL_STR {
		querySql += " where objectType='" + objectType + "'"
	}

	db := ds.DB()
	defer db.Close()

	objectRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for objectRows.Next() {
		object := SafeObject{}

		objectRows.Scan(
			&object.Id,
			&object.SerialId,
			&object.ObjectType,
			&object.ParentPath,
			&object.ObjectName,
			&object.ObjectText,
			&object.ObjectImage,
			&object.ObjectRemark)

		objects = append(objects, object)
	}

	return
}
Beispiel #16
0
func (this *QuerySafeSubSysAction) Post() {
	reqMsg := &QuerySafeSubSysRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	subSysSql := "select * from fast.subSys"

	subSysRows, err := db.Query(subSysSql)
	utils.VerifyErr(err)

	rspMsg := &QuerySafeSubSysResponse{}
	rspMsg.Init(reqMsg)

	for subSysRows.Next() {
		subSys := SubSys{}

		subSysRows.Scan(
			&subSys.Id,
			&subSys.Name)

		rspMsg.SubSyss = append(rspMsg.SubSyss, subSys)
	}

	this.SendJson(rspMsg)
}
Beispiel #17
0
func (this *SelfModUserInfoAction) Post() {
	reqMsg := &SelfModUserInfoRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	selfModSql := "update fast.safeUser set nickName=$1,firstName=$2,lastName=$3,"
	selfModSql += "mobile=$4,email=$5 where id=$6"
	selfModStmt, err := db.Prepare(selfModSql)
	utils.VerifyErr(err)
	selfModStmt.Exec(reqMsg.NickName,
		reqMsg.FirstName,
		reqMsg.LastName,
		reqMsg.Mobile,
		reqMsg.Email,
		reqMsg.Id)
	selfModStmt.Close()

	rspMsg := &SelfModUserInfoResponse{}
	rspMsg.SafeUser = reqMsg.SafeUser
	rspMsg.Init(reqMsg)

	this.SendJson(rspMsg)

}
Beispiel #18
0
func (this *userMgrImpl) init() {

	fmt.Println("  Init User Mgr")

	this.mapUser = map[string](*SafeUser){}

	db := ds.DB()
	defer db.Close()

	querySql := "select * from fast.safeUser"
	userRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	for userRows.Next() {
		user := &SafeUser{}
		userRows.Scan(
			&user.Id,
			&user.DepartId,
			&user.Name,
			&user.Password,
			&user.EmployeeId,
			&user.NickName,
			&user.FirstName,
			&user.LastName,
			&user.Mobile,
			&user.Email,
			&user.UserRemark,
			&user.IsLock,
			&user.LockReason,
			&user.IsForever,
			&user.AccountExpired)
		this.mapUser[user.Id] = user
	}
}
Beispiel #19
0
func (this *QueryMyAccessObjectAction) Post() {
	reqMsg := &QueryMyAccessObjectRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	reqMsg.ObjectType = strings.TrimSpace(reqMsg.ObjectType)

	rspMsg := &QueryMyAccessObjectResponse{}
	rspMsg.Init(reqMsg)

	sessionId := reqMsg.GetReqSessionId()
	session, ok := SessionMgr().GetSession(sessionId)
	if !ok {
		rspMsg.SetRspRetId(msg.MSG_FAIL)
		this.SendJson(rspMsg)
		return
	}

	userId := session.GetUserId()

	db := ds.DB()
	defer db.Close()

	querySql := comm.NULL_STR
	if !session.IsAdmin() {
		querySql += "select distinct obj.id,obj.objectName from fast.safeObject obj, fast.objectAuth auth where "
		querySql += "obj.id = auth.objectId "
		if reqMsg.ObjectType != comm.NULL_STR {
			querySql += "and obj.objectType='" + reqMsg.ObjectType + "' "
		}

		querySql += "and (auth.roleId='" + userId + "' or auth.roleId in(select distinct alloc.roleId "
		querySql += "from fast.roleAlloc alloc where alloc.userId='" + userId + "'))"
	} else {
		querySql += "select distinct obj.id,obj.objectName from fast.safeObject obj where 1=1 "
		if reqMsg.ObjectType != comm.NULL_STR {
			querySql += "and obj.objectType='" + reqMsg.ObjectType + "' "
		}
	}

	fmt.Println("query access object sql:", querySql)

	objRows, err := db.Query(querySql)
	utils.VerifyErr(err)

	objectId := comm.NULL_STR
	objectName := comm.NULL_STR
	for objRows.Next() {
		objRows.Scan(&objectId, &objectName)
		rspMsg.ObjectIds = append(rspMsg.ObjectIds, objectId)
		rspMsg.ObjectNames = append(rspMsg.ObjectNames, objectName)
	}

	this.SendJson(rspMsg)
}
Beispiel #20
0
func (this *QuerySafeOperateAction) Post() {

	reqMsg := &QuerySafeOperateRequest{}
	this.GetReqJson(reqMsg)

	reqMsg.OperateCode = strings.TrimSpace(reqMsg.OperateCode)
	reqMsg.SubSys = strings.TrimSpace(reqMsg.SubSys)
	reqMsg.OperateGroup = strings.TrimSpace(reqMsg.OperateGroup)
	reqMsg.OperateName = strings.TrimSpace(reqMsg.OperateName)

	operateSql := "select * from fast.safeOperate where 1=1"
	if reqMsg.OperateCode != comm.NULL_STR {
		operateSql += " and operateCode='" + reqMsg.OperateCode + "'"
	} else if reqMsg.SubSys != comm.NULL_STR {
		operateSql += " and subsys='" + reqMsg.SubSys + "'"

		if reqMsg.OperateGroup != comm.NULL_STR {
			operateSql += " and operateGroup='" + reqMsg.OperateGroup + "'"

			if reqMsg.OperateName != comm.NULL_STR {
				operateSql += " and operateName='" + reqMsg.OperateName + "'"
			}
		}
	}

	fmt.Println("querySql:", operateSql)

	db := ds.DB()
	defer db.Close()

	operateRows, err := db.Query(operateSql)
	utils.VerifyErr(err)

	rspMsg := &QuerySafeOperateResponse{}
	rspMsg.Init(reqMsg)

	for operateRows.Next() {
		operate := SafeOperate{}
		operateRows.Scan(
			&operate.Id,
			&operate.SerialId,
			&operate.OperateCode,
			&operate.Subsys,
			&operate.OperateGroup,
			&operate.OperateName,
			&operate.OperateDetail,
			&operate.OperateRemark,
			&operate.IsAuth,
			&operate.IsLog)
		rspMsg.Operates = append(rspMsg.Operates, operate)
	}

	this.SendJson(rspMsg)
}
Beispiel #21
0
func (this *safeObjectMgrImpl) DelObjectByName(objectName string) {
	objectName = strings.TrimSpace(objectName)

	db := ds.DB()
	defer db.Close()

	delSql := "delete from fast.safeObject where objectName=$1"

	delStmt, err := db.Prepare(delSql)
	utils.VerifyErr(err)
	delStmt.Exec(objectName)
	delStmt.Close()

	return
}
Beispiel #22
0
func (this *safeObjectMgrImpl) UnAuth(unAuths []ObjectAuthInfo) {

	db := ds.DB()
	defer db.Close()

	unAuthSql := "delete from fast.objectAuth where objectId=$1 and roleId=$2"

	unAuthStmt, err := db.Prepare(unAuthSql)
	utils.VerifyErr(err)
	for _, v := range unAuths {
		unAuthStmt.Exec(v.ObjectId, v.RoleId)
	}
	unAuthStmt.Close()

	return
}
Beispiel #23
0
func (this *safeObjectMgrImpl) Auth(auths []ObjectAuthInfo) {

	db := ds.DB()
	defer db.Close()

	authSql := "insert into fast.objectAuth values($1,$2)"

	authStmt, err := db.Prepare(authSql)
	utils.VerifyErr(err)
	for _, v := range auths {
		authStmt.Exec(v.ObjectId, v.RoleId)
	}
	authStmt.Close()

	return
}
Beispiel #24
0
func (this *safeObjectMgrImpl) unAuthByObj(objectName, objectType string) {
	objectName = strings.TrimSpace(objectName)
	objectType = strings.TrimSpace(objectType)

	db := ds.DB()
	defer db.Close()

	unAuthSql := "delete from fast.objectAuth where objectId in (select id from fast.safeObject where"
	unAuthSql += " objectName=$1 and objectType=$2)"

	unAuthStmt, err := db.Prepare(unAuthSql)
	utils.VerifyErr(err)
	unAuthStmt.Exec(objectName, objectType)

	unAuthStmt.Close()

	return
}
Beispiel #25
0
func (this *sessionMgrImpl) init() {

	fmt.Println("  Init User Session")

	this.mapSessions = map[string](*SafeSession){}
	this.badSessions = map[string](*SafeSession){}

	db := ds.DB()
	defer db.Close()

	initSql := "truncate table fast.safeSession"

	initStmt, err := db.Prepare(initSql)
	utils.VerifyErr(err)

	initStmt.Exec()
	initStmt.Close()
}
Beispiel #26
0
func (this *safeObjectMgrImpl) DelObjectByObjNameAndType(objectName, objectType string) {
	objectName = strings.TrimSpace(objectName)
	objectType = strings.TrimSpace(objectType)

	db := ds.DB()
	defer db.Close()

	delSql := "delete from fast.safeObject where objectName=$1 and objectType=$2"

	delStmt, err := db.Prepare(delSql)
	utils.VerifyErr(err)
	delStmt.Exec(objectName, objectType)
	delStmt.Close()

	this.unAuthByObj(objectName, objectType)

	return
}
Beispiel #27
0
func (this *sessionMgrImpl) logout(sessionId string) {
	_, ok := this.mapSessions[sessionId]
	if !ok {
		return
	}

	delete(this.mapSessions, sessionId)

	db := ds.DB()
	defer db.Close()

	delSql := "delete from fast.safeSession where id=$1"
	delStmt, err := db.Prepare(delSql)
	utils.VerifyErr(err)
	delStmt.Exec(sessionId)
	delStmt.Close()

	return
}
Beispiel #28
0
func (this *QuerySafeRoleAction) Post() {
	reqMsg := &QuerySafeRoleRequest{}
	if !this.GetReqJson(reqMsg) {
		return
	}

	db := ds.DB()
	defer db.Close()

	reqMsg.RoleId = strings.TrimSpace(reqMsg.RoleId)
	reqMsg.RoleName = strings.TrimSpace(reqMsg.RoleName)

	querySql := "select distinct * from fast.safeRole"
	if reqMsg.RoleId != comm.NULL_STR {
		querySql += " where id='" + reqMsg.RoleId + "' "
	} else if reqMsg.RoleName != comm.NULL_STR {
		querySql += " where name='" + reqMsg.RoleName + "' "
	} else {
		querySql += " where isUser=false and isDepart=false"
	}

	querySql += " order by name"

	roleRows, roleErr := db.Query(querySql)
	utils.VerifyErr(roleErr)

	rspMsg := &QuerySafeRoleResponse{}
	for roleRows.Next() {
		role := SafeRole{}
		roleRows.Scan(
			&role.Id,
			&role.Name,
			&role.RoleDetail,
			&role.RoleRemark,
			&role.IsUser,
			&role.IsDepart,
			&role.DefaultSafeObject)
		rspMsg.Roles = append(rspMsg.Roles, role)
	}

	rspMsg.Init(reqMsg)
	this.SendJson(rspMsg)
}
Beispiel #29
0
func (this *fastSysParaMgr) ImportPara(para FastSysPara) {
	importSql := "insert into fast.sysParaConf values($1,$2,$3,$4,$5)"

	this.mapPara[para.ParaName] = &para

	db := ds.DB()
	defer db.Close()
	importStmt, err := db.Prepare(importSql)

	VerifyErr(err)
	importStmt.Exec(
		para.Catalog,
		para.ParaName,
		para.ParaValue,
		para.ParaType,
		para.ParaRemark)
	importStmt.Close()

	return
}
Beispiel #30
0
func (this *userMgrImpl) delUser(userId string) {
	userId = strings.TrimSpace(userId)
	delete(this.mapUser, userId)

	db := ds.DB()
	defer db.Close()

	delUserSql := "delete from fast.safeUser where id=$1"
	delUserStmt, err := db.Prepare(delUserSql)
	utils.VerifyErr(err)
	delUserStmt.Exec(userId)
	delUserStmt.Close()

	delRoleMapSql := "delete from fast.safeRole where id=$1 and isUser=true"
	delRoleMapStmt, err := db.Prepare(delRoleMapSql)
	utils.VerifyErr(err)
	delRoleMapStmt.Exec(userId)
	delRoleMapStmt.Close()

	delRoleAllocSql := "delete from fast.roleAlloc where userId=$1"
	delRoleAllocStmt, err := db.Prepare(delRoleAllocSql)
	utils.VerifyErr(err)
	delRoleAllocStmt.Exec(userId)
	delRoleAllocStmt.Close()

	delOperateAuthSql := "delete from fast.operateAuth where roleId=$1"
	delOperateAuthStmt, err := db.Prepare(delOperateAuthSql)
	utils.VerifyErr(err)
	delOperateAuthStmt.Exec(userId)
	delOperateAuthStmt.Close()

	delObjAuthSql := "delete from fast.roleAlloc where roleId=$1"
	delObjAuthStmt, err := db.Prepare(delObjAuthSql)
	utils.VerifyErr(err)
	delObjAuthStmt.Exec(userId)
	delObjAuthStmt.Close()

	return
}