[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
|
@ -1238,7 +1238,7 @@ class homeDirectory(Attr):
|
|||
Une adresse mail n'est modifiable que si on a au moins autant de droits
|
||||
que la personne à qui est l'adresse mail
|
||||
"""
|
||||
modifiables = set()
|
||||
modifiables = set()
|
||||
for i in liste_droits:
|
||||
if i in DROITS_SUPERVISEUR:
|
||||
modifiables = modifiables.union(DROITS_SUPERVISEUR[i])
|
||||
|
|
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=""
|
||||
|
|
24
objets.py
24
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())
|
||||
|
@ -578,7 +578,7 @@ class CransLdapObject(object):
|
|||
except ldap_locks.LockError:
|
||||
# Si on ne parvient pas à prendre le lock pour l'une des valeurs
|
||||
# on libère les locks pris jusque là et on propage l'erreur
|
||||
# les anciens locks et self._modifs reste bien inchangés
|
||||
# les anciens locks et self._modifs reste bien inchangés
|
||||
for (a, b, c) in locked:
|
||||
self.conn.lockholder.removelock(a, b, c)
|
||||
raise
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
##: Encodage qu'on utilise pour parler à l'utilisateur si on n'a pas réussi à le détecter
|
||||
#fallback_encoding = 'utf-8'
|
||||
#: Encodage de la base LDAP
|
||||
ldap_encoding = "utf-8"
|
||||
ldap_encoding = "utf-8"
|
||||
#: uri par défaut de la base LDAP
|
||||
uri = "ldap://ldap.adm.crans.org/"
|
||||
#: dn racine de l'endroit où sont stockées les données
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue