demenagement vers la même résidence impossible + vérification que l'uid n'est pas déjà pris + reparation de la recherche par email

This commit is contained in:
Romain Beuque 2014-04-01 20:20:30 +02:00
parent 0722244f2d
commit 2bafa6ac19
3 changed files with 14 additions and 4 deletions

View File

@ -8,6 +8,7 @@ from brie.config import groups_enum
from brie.lib.ldap_helper import * from brie.lib.ldap_helper import *
from brie.lib.aurore_helper import * from brie.lib.aurore_helper import *
from brie.model.ldap import * from brie.model.ldap import *
from brie.lib.name_translation_helpers import Translations
from datetime import datetime from datetime import datetime
@ -105,7 +106,16 @@ class MembersController(AuthenticatedBaseController):
#if member.has('mobile'): #if member.has('mobile'):
# phone = member.mobile.first() # phone = member.mobile.first()
#member_uid = self.member_edit_controller.add.post(residence_name, member.givenName.first(), member.sn.first(), member.mail.first(), phone, False) #member_uid = self.member_edit_controller.add.post(residence_name, member.givenName.first(), member.sn.first(), member.mail.first(), phone, False)
member = Member.get_by_dn(self.user, member_dn)
member_uid = member.uid.first()
number = 1
while member is not None:
member_dn = "uid=" + member_uid + number + ",ou=" + str(registration_year) + "," + ldap_config.username_base_dn + residence_dn
number = number + 1
member = Member.get_by_dn(self.user, member_dn)
#end while
self.user.ldap_bind.clone_entry(member_dn, member) self.user.ldap_bind.clone_entry(member_dn, member)
member = Member.get_by_uid(self.user, self.user.residence_dn, member.uid.first()) member = Member.get_by_uid(self.user, self.user.residence_dn, member.uid.first())

View File

@ -60,9 +60,9 @@ class SearchController(AuthenticatedBaseController):
@expose("brie.templates.search.member") @expose("brie.templates.search.member")
def email(self, residence, email, global_search = None): def email(self, residence, email, global_search = None):
if global_search is not None and self.user.groups.admin: if global_search is not None and self.user.groups.admin:
self.email_global(residence, email) return self.email_global(residence, email)
else: else:
self.email_local(residence, email) return self.email_local(residence, email)
#end if #end if
#end def #end def

View File

@ -23,7 +23,7 @@
<td py:otherwise=""><a href="/show/room/${mresidence}/${room.uid.first()}">${room.cn.first()}</a></td> <td py:otherwise=""><a href="/show/room/${mresidence}/${room.uid.first()}">${room.cn.first()}</a></td>
</py:choose> </py:choose>
<td> <td>
<form action="/members/demenageResidence/" style="margin-bottom:0px" method="post" class="inline_block"> <form action="/members/demenageResidence/" style="margin-bottom:0px" method="post" class="inline_block" py:if="mresidence != residence">
<input type="hidden" name="member_dn" value="${member.dn}"/> <input type="hidden" name="member_dn" value="${member.dn}"/>
<input type="submit" value="Move" class="button"/> <input type="submit" value="Move" class="button"/>
</form> </form>