Skip to content

Commit

Permalink
Merge pull request #11 from cannatag/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
cannatag committed Jan 29, 2015
2 parents 234bebb + 288c0ec commit 74fc793
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 9 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ For information and suggestions you can contact me at cannatag@gmail.com or you

CHANGELOG
---------

* 0.9.7.3 2015.01.25
- Modify operation type can also be passed as integer

* 0.9.7.2 2015.01.11
- Fixed a bug when resolving IP address with getaddrinfo(). On OSX returned an UDP connection.

Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ Contact me

For information and suggestions you can contact me at cannatag@gmail.com or you can also a support ticket on https://github.com/cannatag/ldap3/issues/new

* 0.9.7.3 2015.01.25
- Modify operation type can also be passed as integer

* 0.9.7.2 2015.01.16
- Fixed a bug when resolving IP address with getaddrinfo(). On OSX returned an UDP connection.

Expand Down
6 changes: 6 additions & 0 deletions docs/manual/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
CHANGELOG
=========
* 0.9.7.3 2015.01.25
- Modify operation type can also be passed as integer

* 0.9.7.2 2015.01.16
- Fixed a bug when resolving IP address with getaddrinfo(). On OSX returned an UDP connection.

* 0.9.7.1 2015.01.05
- Moved to Github
- Moved to Travis-CI for continuous integration
Expand Down
6 changes: 4 additions & 2 deletions docs/manual/source/quicktour.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ To move from synchronous to asynchronous connection you have just to change the

That's all you have to do to have an asynchronous threaded LDAP client connection.

To get operational attributes (createStamp, modifiedStamp, ...) for response objects add 'get_operational_attribute = True' in the search request::
To get operational attributes (createStamp, modifiedStamp, ...) for response objects add 'get_operational_attributes = True' in the search request::

c.search('o=test','(objectClass=*)', SUBTREE, attributes = ['sn', 'objectClass'], get_operational_attribute = True)
c.search('o=test','(objectClass=*)', SUBTREE, attributes = ['sn', 'objectClass'], get_operational_attributes = True)


Connection context manager
Expand Down Expand Up @@ -105,7 +105,9 @@ Binding
-------

You can bind (authenticate) to the server with any of the authentication method defined in the LDAP v3 protocol: Anonymous, Simple and SASL.

You can perform an automatic bind with the auto_bind=True parameter of the connection object or performing a bind() operation that returns a boolean to indicate if bind was succcesful.

You can read the result of the bind operation in the 'result' attribute of the connection object. If auto_bind is not succesful the library will raise an LDAPBindError exception.

Searching
Expand Down
2 changes: 1 addition & 1 deletion ldap3/core/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def modify(self,
if len(changes[change]) != 2:
self.last_error = 'malformed change'
raise LDAPChangesError(self.last_error)
elif changes[change][0] not in [MODIFY_ADD, MODIFY_DELETE, MODIFY_REPLACE, MODIFY_INCREMENT]:
elif changes[change][0] not in [MODIFY_ADD, MODIFY_DELETE, MODIFY_REPLACE, MODIFY_INCREMENT, 0, 1, 2, 3]:
self.last_error = 'unknown change type'
raise LDAPChangesError(self.last_error)

Expand Down
16 changes: 11 additions & 5 deletions ldap3/operation/modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with ldap3 in the COPYING and COPYING.LESSER files.
# If not, see <http://www.gnu.org/licenses/>.
from .. import SEQUENCE_TYPES

from .. import SEQUENCE_TYPES, MODIFY_ADD, MODIFY_DELETE, MODIFY_REPLACE, MODIFY_INCREMENT
from ..protocol.rfc4511 import ModifyRequest, LDAPDN, Changes, Change, Operation, PartialAttribute, AttributeDescription, Vals, ResultCode
from ..operation.bind import referrals_to_list
from ..protocol.convert import changes_to_list, validate_attribute_value
Expand All @@ -38,10 +39,15 @@
# ... },
# modification PartialAttribute } }

change_table = dict(MODIFY_ADD=0,
MODIFY_DELETE=1,
MODIFY_REPLACE=2,
MODIFY_INCREMENT=3)
change_table = {MODIFY_ADD: 0, # accepts direct values too
MODIFY_DELETE: 1,
MODIFY_REPLACE: 2,
MODIFY_INCREMENT: 3,
0: 0,
1: 1,
2: 2,
3: 3}



def modify_operation(dn,
Expand Down
3 changes: 3 additions & 0 deletions ldap3/protocol/rfc4512.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def attribute_usage_to_constant(value):

def quoted_string_to_list(quoted_string):
string = quoted_string.strip()
if not string:
return list()

if string[0] == '(' and string[-1] == ')':
string = string[1:-1]
elements = string.split("'")
Expand Down

0 comments on commit 74fc793

Please sign in to comment.