python-kadmin icon indicating copy to clipboard operation
python-kadmin copied to clipboard

Access/modify attributes of principal

Open ehashman opened this issue 10 years ago • 2 comments

It would be cool if I could use this library to modify the "Attributes" field of principals; for instance, to set +needchange on user principals to expire passwords rather than hard-expiring them with a date.

Interface could look something like

>>> princ.attributes
['REQUIRES_PRE_AUTH']
>>> princ.attributes.append('REQUIRES_PWCHANGE')
>>> princ.attributes
['REQUIRES_PRE_AUTH', 'REQUIRES_PWCHANGE']

corresponding to

kadmin: getprinc foobar
Principal: [email protected]
...
Attributes: REQUIRES_PRE_AUTH REQUIRES_PWCHANGE
kadmin: modprinc +needchange foobar
Principal "[email protected]" modified.

in kadmin.

I could write a pull request if someone were to point me in the right direction re: docs, etc.

ehashman avatar Jan 09 '16 15:01 ehashman

This functionality exists, it's just not documented...

princ.set_flags(kadmin.REQUIRES_PWCHANGE) princ.commit()

(Also princ.unset_flags)

ghost avatar Mar 04 '16 15:03 ghost

It exists, but the code hasn't been fleshed out (there are still comments floating around) and the interface could be more user-friendly. If I have time I plan on fixing this up and writing some docs.

ehashman avatar Mar 06 '16 18:03 ehashman