From 023a9eb448b84db2ebfe580a573e5555a857f2f3 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Mon, 19 Jan 2015 22:38:58 +0100 Subject: [PATCH 1/2] add new task set_ldap_user_password --- docs/changelog.rst | 2 ++ gvaldap/ldaptasks/tasks.py | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 03031e3..f758911 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,8 @@ Changelog ========= +* :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/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): """ From 48558baafcc88303c52455ca4a805e050200d02f Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sat, 24 Jan 2015 16:02:25 +0100 Subject: [PATCH 2/2] set version number, mark release in changelog --- docs/changelog.rst | 1 + docs/conf.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f758911..61c8dda 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,7 @@ 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>` 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.