Esempio n. 1
0
func getLoginName(hmSession *session.MySession) string {
	if hmSession == nil {
		return ""
	}
	grantors, err := hmSession.Get(session.SESSION_GRANTORS_KEY)
	if err != nil {
		base.Logger().Errorln("SessionGetError (field=%s): %s\n", session.SESSION_GRANTORS_KEY, err)
		return ""
	}
	return grantors
}
Esempio n. 2
0
func getGroupName(hmSession *session.MySession) string {
	if hmSession == nil {
		return ""
	}
	groupName, err := hmSession.Get(session.SESSION_GROUP_KEY)
	if err != nil {
		base.Logger().Errorln("SessionGetError (field=%s): %s\n", session.SESSION_GROUP_KEY, err)
		return ""
	}
	return groupName
}
Esempio n. 3
0
func getPageRights(hmSession *session.MySession) map[string]string {
	var pageRights map[string]string
	if hmSession == nil {
		return pageRights
	}
	groupName, err := hmSession.Get(session.SESSION_GROUP_KEY)
	if err != nil {
		base.Logger().Errorln("SessionGetError (field=%s): %s\n", session.SESSION_GROUP_KEY, err)
		return pageRights
	}
	userGroup, err := rights.GetUserGroup(groupName)
	if err != nil {
		base.Logger().Errorln("GetUserGroupError (groupName=%s): %s\n", groupName, err)
		return pageRights
	}
	if userGroup != nil {
		pageRights = userGroup.Rights.PageRights
	}
	return pageRights
}