Merge branch 'release/0.4.0' into production

* release/0.4.0:
  set version number, mark release in changelog
  add new task set_ldap_user_password
This commit is contained in:
Jan Dittberner 2015-01-24 16:03:14 +01:00
commit 57161ab89e
3 changed files with 26 additions and 2 deletions

View file

@ -1,6 +1,9 @@
Changelog Changelog
========= =========
* :release:`0.4.0 <2015-01-24>`
* :feature:`-` add new task :py:func:`ldaptasks.tasks.set_ldap_user_password`
* :release:`0.3.0 <2015-01-19>` * :release:`0.3.0 <2015-01-19>`
* :support:`-` move tasks from osusers to ldaptasks.tasks * :support:`-` move tasks from osusers to ldaptasks.tasks

View file

@ -60,9 +60,9 @@ copyright = u'2014, 2015 Jan Dittberner'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.3' version = '0.4'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.3.0' release = '0.4.0'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

View file

@ -105,6 +105,27 @@ def create_ldap_user(username, uid, gid, gecos, homedir, shell, password):
return ldapuser.dn return ldapuser.dn
@shared_task(bind=True)
def set_ldap_user_password(self, username, password):
"""
This task sets the password of an existing :py:class:`LDAP user
<ldapentities.models.LdapUser>`.
:param str username: the user name
:param str password: teh clear text password
:return: :py:const:`True` if the password has been set, :py:const:`False`
if the user does not exist.
"""
try:
ldapuser = LdapUser.objects.get(username=username)
except LdapUser.DoesNotExist:
return False
ldapuser.set_password(password)
ldapuser.save()
return True
@shared_task(bind=True) @shared_task(bind=True)
def add_ldap_user_to_group(self, username, groupname): def add_ldap_user_to_group(self, username, groupname):
""" """