summaryrefslogtreecommitdiffstats
path: root/modify.go
diff options
context:
space:
mode:
authordirkm <dirkmoermans@gmail.com>2019-07-03 20:23:29 +0200
committerNed McClain <nedmcclain@gmail.com>2019-07-03 20:23:29 +0200
commitee4388c038f5d0912e2e2700443853308b6e621d (patch)
tree6cad5748c8de565bc02ff579adc158f8664f76cd /modify.go
parentImplement FilterSubstrings (#2) (diff)
downloadldap-ee4388c038f5d0912e2e2700443853308b6e621d.tar
ldap-ee4388c038f5d0912e2e2700443853308b6e621d.tar.gz
ldap-ee4388c038f5d0912e2e2700443853308b6e621d.tar.bz2
ldap-ee4388c038f5d0912e2e2700443853308b6e621d.tar.lz
ldap-ee4388c038f5d0912e2e2700443853308b6e621d.tar.xz
ldap-ee4388c038f5d0912e2e2700443853308b6e621d.tar.zst
ldap-ee4388c038f5d0912e2e2700443853308b6e621d.zip
Diffstat (limited to '')
-rw-r--r--modify.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/modify.go b/modify.go
index 6ffe314..1137e2f 100644
--- a/modify.go
+++ b/modify.go
@@ -49,15 +49,15 @@ var LDAPModifyAttributeMap = map[uint64]string{
}
type PartialAttribute struct {
- attrType string
- attrVals []string
+ AttrType string
+ AttrVals []string
}
func (p *PartialAttribute) encode() *ber.Packet {
seq := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "PartialAttribute")
- seq.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, p.attrType, "Type"))
+ seq.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, p.AttrType, "Type"))
set := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSet, nil, "AttributeValue")
- for _, value := range p.attrVals {
+ for _, value := range p.AttrVals {
set.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, value, "Vals"))
}
seq.AppendChild(set)
@@ -65,41 +65,41 @@ func (p *PartialAttribute) encode() *ber.Packet {
}
type ModifyRequest struct {
- dn string
- addAttributes []PartialAttribute
- deleteAttributes []PartialAttribute
- replaceAttributes []PartialAttribute
+ Dn string
+ AddAttributes []PartialAttribute
+ DeleteAttributes []PartialAttribute
+ ReplaceAttributes []PartialAttribute
}
func (m *ModifyRequest) Add(attrType string, attrVals []string) {
- m.addAttributes = append(m.addAttributes, PartialAttribute{attrType: attrType, attrVals: attrVals})
+ m.AddAttributes = append(m.AddAttributes, PartialAttribute{AttrType: attrType, AttrVals: attrVals})
}
func (m *ModifyRequest) Delete(attrType string, attrVals []string) {
- m.deleteAttributes = append(m.deleteAttributes, PartialAttribute{attrType: attrType, attrVals: attrVals})
+ m.DeleteAttributes = append(m.DeleteAttributes, PartialAttribute{AttrType: attrType, AttrVals: attrVals})
}
func (m *ModifyRequest) Replace(attrType string, attrVals []string) {
- m.replaceAttributes = append(m.replaceAttributes, PartialAttribute{attrType: attrType, attrVals: attrVals})
+ m.ReplaceAttributes = append(m.ReplaceAttributes, PartialAttribute{AttrType: attrType, AttrVals: attrVals})
}
func (m ModifyRequest) encode() *ber.Packet {
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationModifyRequest, nil, "Modify Request")
- request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, m.dn, "DN"))
+ request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, m.Dn, "DN"))
changes := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Changes")
- for _, attribute := range m.addAttributes {
+ for _, attribute := range m.AddAttributes {
change := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Change")
change.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(AddAttribute), "Operation"))
change.AppendChild(attribute.encode())
changes.AppendChild(change)
}
- for _, attribute := range m.deleteAttributes {
+ for _, attribute := range m.DeleteAttributes {
change := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Change")
change.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(DeleteAttribute), "Operation"))
change.AppendChild(attribute.encode())
changes.AppendChild(change)
}
- for _, attribute := range m.replaceAttributes {
+ for _, attribute := range m.ReplaceAttributes {
change := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Change")
change.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(ReplaceAttribute), "Operation"))
change.AppendChild(attribute.encode())
@@ -113,7 +113,7 @@ func NewModifyRequest(
dn string,
) *ModifyRequest {
return &ModifyRequest{
- dn: dn,
+ Dn: dn,
}
}