[lc_ldap/clubs] La mise en place des clubs dans l'intranet a été faite trop tôt.
* Aucun système de droit permettant au responsable de modifier club/machines de club n'avait été mis en place. C'est corrigé.
This commit is contained in:
parent
5559fa1876
commit
35f9c36461
4 changed files with 30 additions and 13 deletions
15
lc_ldap.py
15
lc_ldap.py
|
@ -538,7 +538,6 @@ class lc_ldap(ldap.ldapobject.LDAPObject, object):
|
|||
|
||||
if objdn.endswith(self.dn) and objdn != self.dn:
|
||||
return [attributs.parent]
|
||||
|
||||
else:
|
||||
return []
|
||||
|
||||
|
@ -554,7 +553,21 @@ class lc_ldap(ldap.ldapobject.LDAPObject, object):
|
|||
else:
|
||||
return []
|
||||
|
||||
def _check_respo(self, obj):
|
||||
"""
|
||||
Teste si l'objet fourni a pour responsable self.
|
||||
Retourne une liste qui s'ajoutera à la liste des droits
|
||||
"""
|
||||
|
||||
if "cid=" in obj.dn:
|
||||
club = obj
|
||||
if isinstance(obj, objets.machine) or isinstance(obj, objets.facture):
|
||||
club = obj.proprio()
|
||||
if isinstance(club, objets.club) and "aid=" + str(club['responsable'][0]) + "," + variables.base_dn == self.dn:
|
||||
return [attributs.respo]
|
||||
return []
|
||||
|
||||
return []
|
||||
|
||||
def get_local_machines(self, mode='ro'):
|
||||
filter=""
|
||||
|
|
22
objets.py
22
objets.py
|
@ -134,7 +134,7 @@ class CransLdapObject(object):
|
|||
la méthode est en anglais pour ne pas interférer avec les attributs droits et jinja2
|
||||
où les méthodes de l'objet et ses attributs sont appelé de la même manière
|
||||
"""
|
||||
return self.conn.droits + self.conn._check_parent(self.dn) + self.conn._check_self(self.dn)
|
||||
return self.conn.droits + self.conn._check_parent(self.dn) + self.conn._check_self(self.dn) + self.conn._check_respo(self)
|
||||
|
||||
def __init__(self, conn, dn, mode='ro', uldif=None, lockId=None):
|
||||
'''
|
||||
|
@ -180,15 +180,15 @@ class CransLdapObject(object):
|
|||
if dn == variables.base_dn:
|
||||
mode = 'ro'
|
||||
|
||||
if mode in ['w', 'rw']:
|
||||
if not self.may_be(variables.modified):
|
||||
raise EnvironmentError("Vous n'avez pas le droit de modifier cet objet.")
|
||||
|
||||
self.mode = mode
|
||||
|
||||
if self.mode in ['w', 'rw']:
|
||||
if not self.may_be(variables.modified):
|
||||
raise EnvironmentError("Vous n'avez pas le droit de modifier cet objet. DEB(dn=%s,user=%s,rights=%s)" % (dn, self.conn.dn, self.rights()))
|
||||
|
||||
self.update_attribs()
|
||||
|
||||
if mode in ['w', 'rw']:
|
||||
if self.mode in ['w', 'rw']:
|
||||
# Vérification que `λv. str(Attr(v))` est bien une projection
|
||||
# C'est-à-dire que si on str(Attr(str(Attr(v)))) on retombe sur str(Attr(v))
|
||||
oldif = lc_ldap.ldif_to_uldif(self.attrs.to_ldif())
|
||||
|
@ -918,9 +918,9 @@ class proprio(CransLdapObject):
|
|||
|
||||
class machine(CransLdapObject):
|
||||
u""" Une machine """
|
||||
can_be_by = { variables.created: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent],
|
||||
variables.modified: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent],
|
||||
variables.deleted: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent],
|
||||
can_be_by = { variables.created: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent, attributs.respo],
|
||||
variables.modified: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent, attributs.respo],
|
||||
variables.deleted: [attributs.nounou, attributs.bureau, attributs.cableur, attributs.parent, attributs.respo],
|
||||
}
|
||||
|
||||
attribs = [attributs.mid, attributs.macAddress, attributs.host,
|
||||
|
@ -1150,6 +1150,10 @@ class adherent(proprio):
|
|||
@crans_object
|
||||
class club(proprio):
|
||||
u"""Club crans"""
|
||||
can_be_by = { variables.created: [attributs.nounou, attributs.bureau, attributs.cableur],
|
||||
variables.modified: [attributs.nounou, attributs.bureau, attributs.respo, attributs.cableur],
|
||||
variables.deleted: [attributs.nounou, attributs.bureau],
|
||||
}
|
||||
attribs = proprio.attribs + [attributs.cid, attributs.responsable, attributs.imprimeurClub]
|
||||
ldap_name = "club"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue