Skip to content

Commit 7dfa21a

Browse files
authored
Improve ppolicy documentation
python-ldap#397
1 parent 4993d4a commit 7dfa21a

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
extensions = [
3434
'sphinx.ext.autodoc',
3535
'sphinx.ext.intersphinx',
36+
'sphinx.ext.napoleon',
3637
]
3738

3839
try:

Doc/reference/ldap-controls.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,16 @@ search.
209209

210210
.. autoclass:: ldap.controls.readentry.PostReadControl
211211
:members:
212+
213+
214+
:py:mod:`ldap.controls.ppolicy` Password Policy Control
215+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
216+
217+
.. seealso::
218+
`draft-behera-ldap-password-policy <https://tools.ietf.org/html/draft-behera-ldap-password-policy>`_
219+
220+
.. py:module:: ldap.controls.ppolicy
221+
:synopsis: passworld policies
222+
223+
.. autoclass:: ldap.controls.ppolicy.PasswordPolicyControl
224+
:members:

Lib/ldap/controls/ppolicy.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,31 @@ class PasswordPolicyResponseValue(univ.Sequence):
6262

6363

6464
class PasswordPolicyControl(ValueLessRequestControl,ResponseControl):
65+
"""
66+
Indicates the errors and warnings about the password policy.
67+
68+
Attributes
69+
----------
70+
71+
timeBeforeExpiration : int
72+
The time before the password expires.
73+
74+
graceAuthNsRemaining : int
75+
The number of grace authentications remaining.
76+
77+
error: int
78+
The password and authentication errors.
79+
"""
6580
controlType = '1.3.6.1.4.1.42.2.27.8.5.1'
6681

6782
def __init__(self,criticality=False):
6883
self.criticality = criticality
69-
70-
def decodeControlValue(self,encodedControlValue):
71-
ppolicyValue,_ = decoder.decode(encodedControlValue,asn1Spec=PasswordPolicyResponseValue())
7284
self.timeBeforeExpiration = None
7385
self.graceAuthNsRemaining = None
7486
self.error = None
7587

88+
def decodeControlValue(self,encodedControlValue):
89+
ppolicyValue,_ = decoder.decode(encodedControlValue,asn1Spec=PasswordPolicyResponseValue())
7690
warning = ppolicyValue.getComponentByName('warning')
7791
if warning.hasValue():
7892
if 'timeBeforeExpiration' in warning:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy