debut d'ajout de membre
This commit is contained in:
parent
c5b1f779a5
commit
66689d3137
@ -9,6 +9,8 @@ from brie.lib.ldap_helper import *
|
||||
from brie.lib.aurore_helper import *
|
||||
from brie.model.ldap import *
|
||||
|
||||
import datetime
|
||||
|
||||
from brie.controllers import auth
|
||||
from brie.controllers.auth import AuthenticatedBaseController, AuthenticatedRestController
|
||||
|
||||
@ -39,7 +41,7 @@ class MembersController(AuthenticatedBaseController):
|
||||
if rooms is None:
|
||||
raise Exception("unable to retrieve rooms")
|
||||
#end if
|
||||
rooms = sorted(rooms, key=lambda t:t.cn.first())
|
||||
rooms = sorted(rooms, key=lambda t:t.uid.first())
|
||||
|
||||
for m in members:
|
||||
for r in rooms:
|
||||
@ -54,6 +56,13 @@ class MembersController(AuthenticatedBaseController):
|
||||
}
|
||||
#end def
|
||||
|
||||
# @expose("brie.templates.members.index")
|
||||
# def search(self, residence_name, query)
|
||||
# responses = index(self, residence_name)
|
||||
|
||||
# retu
|
||||
|
||||
|
||||
|
||||
class MembersAddController(AuthenticatedRestController):
|
||||
require_group = groups_enum.admin
|
||||
@ -67,7 +76,16 @@ class MembersAddController(AuthenticatedRestController):
|
||||
|
||||
residence_dn = Residences.get_dn_by_name(self.user, residence)
|
||||
|
||||
member_dn = "uid=" + member_uid + "," + ldap_config.username_base_dn + residence_dn
|
||||
now = datetime.datetime.now()
|
||||
year = 0
|
||||
|
||||
if now.month >= 8:
|
||||
year = now.year
|
||||
else:
|
||||
year = now.year - 1
|
||||
#endif
|
||||
|
||||
member_dn = "uid=" + member_uid + ",ou=" + str(year) + "," + ldap_config.username_base_dn + residence_dn
|
||||
self.user.ldap_bind.add_entry(member_dn, member)
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
<div class="section">
|
||||
<span class="section_name show_section_name"></span>
|
||||
<a py:if="user.groups.admin" class="button" href="/rooms/index/${residence}/" >CHAMBRES</a>
|
||||
<a py:if="user.groups.admin" class="button" href="/members/index/${residence}/" >MEMBRES</a>
|
||||
<a py:if="user.groups.responsablereseau" class="button" href="/administration/" >ADMINISTRATION</a>
|
||||
</div>
|
||||
<div class="section" >
|
||||
|
@ -35,17 +35,27 @@
|
||||
</div>
|
||||
<div>
|
||||
<form method="post" action="/members/add/">
|
||||
<input type="hidden" name="residence" value="${residence}" />
|
||||
<input type="text" placeholder="prenom" name="prenom" /><br />
|
||||
<input type="text" placeholder="nom" name="nom" /><br />
|
||||
<input type="email" placeholder="e-mail" name="mail" />
|
||||
<input type="hidden" name="residence" value="${residence}" />
|
||||
<input type="email" placeholder="email" name="mail" /><br />
|
||||
<input type="submit" value="GO!" />
|
||||
</form>
|
||||
</div>
|
||||
<div py:for="member in members" class="area section">
|
||||
<div>
|
||||
<span>${member.cn.first()}</span>
|
||||
<span py:if="member.room">${member.room.cn.first()}</span>
|
||||
</div>
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
<th>prenom</th>
|
||||
<th>nom</th>
|
||||
<th>chambres</th>
|
||||
</tr>
|
||||
|
||||
<tr py:for="member in members">
|
||||
<td><a href="/show/member/${residence}/${member.uid.first()}">${member.givenName.first()}</a></td>
|
||||
<td><a href="/show/member/${residence}/${member.uid.first()}">${member.sn.first()}</a></td>
|
||||
<py:choose test="member.room">
|
||||
<td py:when="None"></td>
|
||||
<td py:otherwise=""><a href="/show/room/${residence}/${member.room.cn.first()}">${member.room.cn.first()}</a></td>
|
||||
</py:choose>
|
||||
</tr>
|
||||
</table>
|
||||
</html>
|
||||
|
@ -31,7 +31,7 @@
|
||||
</div>
|
||||
-->
|
||||
<div class="area section">
|
||||
<span class="section_name">PREVIEW</span>
|
||||
<span class="section_name">PREVIEW</span> <a href="/members/index/${residence}">Membres</a>
|
||||
<div py:if="defined('preview')">
|
||||
<py:with vars="member_ldap, room_preview = preview">
|
||||
<div class="room_number">
|
||||
|
Loading…
Reference in New Issue
Block a user