diff --git a/docs/changelog.rst b/docs/changelog.rst index 03031e3..61c8dda 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,9 @@ 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>` * :support:`-` move tasks from osusers to ldaptasks.tasks diff --git a/docs/conf.py b/docs/conf.py index 77e3a10..9036feb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,9 +60,9 @@ copyright = u'2014, 2015 Jan Dittberner' # built documents. # # The short X.Y version. -version = '0.3' +version = '0.4' # 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 # for a list of supported languages. diff --git a/gvaldap/ldaptasks/tasks.py b/gvaldap/ldaptasks/tasks.py index 1bd5c75..a1af2c7 100644 --- a/gvaldap/ldaptasks/tasks.py +++ b/gvaldap/ldaptasks/tasks.py @@ -105,6 +105,27 @@ def create_ldap_user(username, uid, gid, gecos, homedir, shell, password): 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 + `. + + :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) def add_ldap_user_to_group(self, username, groupname): """