Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
midPoint
connector-ldap
Commits
8fc0434b
Commit
8fc0434b
authored
Apr 01, 2019
by
Ing. František DVOŘÁK
Browse files
Support for LDAP attribute options in search, create, and modify operations
parent
d80ba190
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/evolveum/polygon/connector/ldap/AbstractLdapConnector.java
View file @
8fc0434b
...
...
@@ -856,7 +856,7 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
AttributeType
ldapAttrType
=
shcemaTranslator
.
toLdapAttribute
(
ldapStructuralObjectClass
,
icfAttr
.
getName
());
List
<
Value
>
ldapValues
=
shcemaTranslator
.
toLdapValues
(
ldapAttrType
,
icfAttr
.
getValue
());
// Do NOT set attributeType here. The attributeType may not match the type of the value.
entry
.
put
(
ldapAttrType
.
getName
(),
ldapValues
.
toArray
(
new
Value
[
ldapValues
.
size
()]));
entry
.
put
(
icfAttr
.
getName
(),
ldapValues
.
toArray
(
new
Value
[
ldapValues
.
size
()]));
// no simple way how to check if he attribute was added. It may end up with ERR_04451. So let's just
// hope that it worked well. It should - unless there is a connector bug.
}
...
...
@@ -1107,7 +1107,7 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
}
private
void
addLdapModification
(
List
<
Modification
>
ldapModifications
,
ModificationOperation
modOp
,
AttributeType
ldapAttributeType
,
List
<
Object
>
values
)
{
ModificationOperation
modOp
,
String
nativeName
,
AttributeType
ldapAttributeType
,
List
<
Object
>
values
)
{
if
(
values
==
null
)
{
return
;
}
...
...
@@ -1116,12 +1116,12 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
// Do NOT set AttributeType here
// The attributeType might not match the Value class
// e.g. human-readable jpegPhoto attribute will expect StringValue
ldapModifications
.
add
(
new
DefaultModification
(
modOp
,
ldapAttributeType
.
get
Name
(
))
);
ldapModifications
.
add
(
new
DefaultModification
(
modOp
,
native
Name
))
;
}
else
{
// Do NOT set AttributeType here
// The attributeType might not match the Value class
// e.g. human-readable jpegPhoto attribute will expect StringValue
DefaultAttribute
ldapAttribute
=
new
DefaultAttribute
(
ldapAttributeType
.
get
Name
()
,
ldapValues
.
toArray
(
new
Value
[
ldapValues
.
size
()]));
DefaultAttribute
ldapAttribute
=
new
DefaultAttribute
(
native
Name
,
ldapValues
.
toArray
(
new
Value
[
ldapValues
.
size
()]));
ldapModifications
.
add
(
new
DefaultModification
(
modOp
,
ldapAttribute
));
}
}
...
...
@@ -1180,9 +1180,9 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
&&
!
ArrayUtils
.
contains
(
configuration
.
getOperationalAttributes
(),
delta
.
getName
()))
{
throw
new
InvalidAttributeValueException
(
"Unknown attribute "
+
delta
.
getName
()+
" in object class "
+
connIdObjectClass
);
}
addLdapModification
(
modifications
,
ModificationOperation
.
REPLACE_ATTRIBUTE
,
ldapAttributeType
,
delta
.
getValuesToReplace
());
addLdapModification
(
modifications
,
ModificationOperation
.
ADD_ATTRIBUTE
,
ldapAttributeType
,
delta
.
getValuesToAdd
());
addLdapModification
(
modifications
,
ModificationOperation
.
REMOVE_ATTRIBUTE
,
ldapAttributeType
,
delta
.
getValuesToRemove
());
addLdapModification
(
modifications
,
ModificationOperation
.
REPLACE_ATTRIBUTE
,
delta
.
getName
(),
ldapAttributeType
,
delta
.
getValuesToReplace
());
addLdapModification
(
modifications
,
ModificationOperation
.
ADD_ATTRIBUTE
,
delta
.
getName
(),
ldapAttributeType
,
delta
.
getValuesToAdd
());
addLdapModification
(
modifications
,
ModificationOperation
.
REMOVE_ATTRIBUTE
,
delta
.
getName
(),
ldapAttributeType
,
delta
.
getValuesToRemove
());
}
protected
void
postUpdate
(
ObjectClass
connIdObjectClass
,
Uid
uid
,
Set
<
AttributeDelta
>
deltas
,
...
...
src/main/java/com/evolveum/polygon/connector/ldap/schema/AbstractSchemaTranslator.java
View file @
8fc0434b
...
...
@@ -1341,6 +1341,10 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
}
}
else
{
ldapAttributeNameFromSchema
=
ldapAttributeType
.
getName
();
// handle attribute options
String
[]
a
=
ldapAttributeName
.
split
(
";"
,
2
);
if
(
a
.
length
>
1
)
ldapAttributeNameFromSchema
=
ldapAttributeNameFromSchema
+
";"
+
a
[
1
];
}
String
icfAttributeName
=
toConnIdAttributeName
(
ldapAttributeNameFromSchema
);
ab
.
setName
(
icfAttributeName
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment