mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 08:21:05 -06:00
Add can_add() and can_delete() GER helpers
This commit is contained in:
parent
b35849b47d
commit
aa2183578c
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user