func (u *UserInfoLDAPSource) GetDescriptionvalue(groupname string) (string, error) {
	conn, err := u.getTargetLDAPConnection()
	if err != nil {
		log.Println(err)
		return "Error in getTargetLDAPConnection", err
	}
	defer conn.Close()

	searchRequest := ldap.NewSearchRequest(
		u.GroupSearchBaseDNs,
		ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
		"(&(cn="+groupname+" )(objectClass=posixGroup))",
		[]string{u.GroupManageAttribute, "cn"},
		nil,
	)
	sr, err := conn.Search(searchRequest)
	if err != nil {
		log.Println(err)
		return "", err
	}
	if len(sr.Entries) > 1 {
		log.Println("GetDescriptionValue: Duplicate entries found")
		return "", errors.New("Multiple entries found, Contact the administrator!")
	}
	if len(sr.Entries) < 1 {
		return "", userinfo.GroupDoesNotExist
	}
	if sr.Entries[0].GetAttributeValues(u.GroupManageAttribute) == nil {
		log.Println("No group managed attribute")
		return "", nil
	}
	GroupmanagedbyValue := sr.Entries[0].GetAttributeValue(u.GroupManageAttribute)
	switch strings.ToLower(u.GroupManageAttribute) {
	case "owner":
		groupCN, err := extractCNFromDNString([]string{GroupmanagedbyValue})
		if err != nil {
			log.Println(err)
			return "", err
		}
		GroupmanagedbyValue = groupCN[0]
	default:
		GroupmanagedbyValue = GroupmanagedbyValue
	}
	log.Printf("groupmanagedbyValue=%s", GroupmanagedbyValue)

	return GroupmanagedbyValue, nil
}
//get description of a group
get description of a group
// get description of a group
func (u *UserInfoLDAPSource) GetDescriptionvalue(groupname string) (string, error) {
	conn, err := u.getTargetLDAPConnection()
	if err != nil {
		log.Println(err)
		return "Error in getTargetLDAPConnection", err
	}
	defer conn.Close()
	searchRequest := ldap.NewSearchRequest(
		u.GroupSearchBaseDNs,
		ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
		"(&(cn="+groupname+" )(objectClass=posixGroup))",
		[]string{u.GroupManageAttribute, "cn"},
		nil,
	)
	sr, err := conn.Search(searchRequest)
	if err != nil {
		log.Println(err)
		return "", err
	}
	if len(sr.Entries) > 1 {
		log.Println("GetDescriptionValue: Duplicate entries found")
		return "", errors.New("Multiple entries found, Contact the administrator!")
	}
	if len(sr.Entries) < 1 {
		return "", userinfo.GroupDoesNotExist
	}
	if sr.Entries[0].GetAttributeValues(u.GroupManageAttribute) == nil {
		log.Println("No group managed attribute")
		return "", nil
	}
	GroupmanagedbyValue := sr.Entries[0].GetAttributeValue(u.GroupManageAttribute)
	switch strings.ToLower(u.GroupManageAttribute) {
	case "owner":
		groupCN, err := extractCNFromDNString([]string{GroupmanagedbyValue})
		if err != nil {
			log.Println(err)
			return "", err
		}
		GroupmanagedbyValue = groupCN[0]
	default:
		GroupmanagedbyValue = GroupmanagedbyValue
	}
	log.Printf("groupmanagedbyValue=%s", GroupmanagedbyValue)
	return GroupmanagedbyValue, nil
}
func ( u * UserInfoLDAPSource ) GetDescriptionvalue ( groupname string ) ( string , error ) { conn , err := u . getTargetLDAPConnection ( ) if err != nil { log . Println ( err ) return " " , err } defer conn . Close ( ) searchRequest := ldap . NewSearchRequest ( u . GroupSearchBaseDNs , ldap . ScopeWholeSubtree , ldap . NeverDerefAliases , 0 , 0 , false , " " + groupname + " " , [ ] string { u . GroupManageAttribute , " " } , nil , ) sr , err := conn . Search ( searchRequest ) if err != nil { log . Println ( err ) return " " , err } if len ( sr . Entries ) > 1 { log . Println ( " " ) return " " , errors . New ( " " ) } if len ( sr . Entries ) < 1 { return " " , userinfo . GroupDoesNotExist } if sr . Entries [ 0 ] . GetAttributeValues ( u . GroupManageAttribute ) == nil { log . Println ( " " ) return " " , nil } GroupmanagedbyValue := sr . Entries [ 0 ] . GetAttributeValue ( u . GroupManageAttribute ) switch strings . ToLower ( u . GroupManageAttribute ) { case " " : groupCN , err := extractCNFromDNString ( [ ] string { GroupmanagedbyValue } ) if err != nil { log . Println ( err ) return " " , err } GroupmanagedbyValue = groupCN [ 0 ] default : GroupmanagedbyValue = GroupmanagedbyValue } log . Printf ( " " , GroupmanagedbyValue ) return GroupmanagedbyValue , nil }
get description of a group
get description of a group