diff options
author | Rob Crittenden <rcritten@redhat.com> | 2009-10-20 11:57:02 -0400 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2009-10-21 03:11:45 -0600 |
commit | aa2183578cb58d9f55b5f1b64c13627b88dae37c (patch) | |
tree | 9222543ce65d7b04e50768662e46c6203b742b39 /ipaserver | |
parent | b35849b47d1018fef339ea63e364b29c848bd26d (diff) | |
download | freeipa-aa2183578cb58d9f55b5f1b64c13627b88dae37c.tar.gz freeipa-aa2183578cb58d9f55b5f1b64c13627b88dae37c.tar.xz freeipa-aa2183578cb58d9f55b5f1b64c13627b88dae37c.zip |
Add can_add() and can_delete() GER helpers
Diffstat (limited to 'ipaserver')
-rw-r--r-- | ipaserver/plugins/ldap2.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py index 9c655eced..f8e06576d 100644 --- a/ipaserver/plugins/ldap2.py +++ b/ipaserver/plugins/ldap2.py @@ -534,6 +534,43 @@ class ldap2(CrudBackend, Encoder): return False + # + # Entry-level effective rights + # + # a - Add + # d - Delete + # n - Rename the DN + # v - View the entry + # + + @encode_args(1) + def can_delete(self, dn): + """Returns True/False if the currently bound user has delete permissions + on the entry. + """ + (dn, attrs) = self.get_effective_rights(dn, ["*"]) + import pdb + pdb.set_trace() + if 'entrylevelrights' in attrs: + entry_rights = attrs['entrylevelrights'][0].decode('UTF-8') + if 'd' in entry_rights: + return True + + return False + + @encode_args(1) + def can_add(self, dn): + """Returns True/False if the currently bound user has add permissions + on the entry. + """ + (dn, attrs) = self.get_effective_rights(dn, ["*"]) + if 'entrylevelrights' in attrs: + entry_rights = attrs['entrylevelrights'][0].decode('UTF-8') + if 'a' in entry_rights: + return True + + return False + @encode_args(1, 2) def update_entry_rdn(self, dn, new_rdn, del_old=True): """ |