Refonte de la page d'accueil, ajout d'autorisations sur la page d'accueil et preparation pour 'admin_read'

This commit is contained in:
Roven Gabriel 2014-02-21 19:26:55 +01:00
parent 9723d198d1
commit cd6ca685ce
7 changed files with 79 additions and 33 deletions

View File

@ -797,7 +797,7 @@ class RoomChangeMemberController(AuthenticatedRestController):
""" Controller REST de gestion de la deconnexion globale. """
class AllMembersDisableController(AuthenticatedRestController):
require_group = groups_enum.admin
require_group = groups_enum.responsablereseau
""" Gestion des requêtes post sur ce controller """
@expose("brie.templates.index")
@ -832,7 +832,7 @@ class AllMembersDisableController(AuthenticatedRestController):
""" Controller REST de gestion de la reconnexion globale. """
class AllMembersEnableController(AuthenticatedRestController):
require_group = groups_enum.admin
require_group = groups_enum.responsablereseau
""" Gestion des requêtes post sur ce controller """
@expose("brie.templates.index")

View File

@ -44,13 +44,19 @@ class RoomsController(AuthenticatedBaseController):
def index(self, residence_name):
status = dict()
areas = dict()
print "here 1"
residence_dn = Residences.get_dn_by_name(self.user, residence_name)
if residence_dn is None:
raise Exception("unknown residence")
#end if
stats = CotisationComputes.members_status_from_residence(self.user, residence_dn)
print "here 1 bis"
stats = CotisationComputes.members_status_from_residence(self.user, residence_dn)
print "here 2"
members = dict()
for label in stats:
for member in stats[label]:
@ -58,9 +64,13 @@ class RoomsController(AuthenticatedBaseController):
#end for member
#end for stats
print "here 3"
stats['number_of_rooms'] = Room.get_number_of_rooms(self.user, residence_dn)
stats['empty_rooms'] = []
print "here 4"
for area in Room.get_areas(self.user, residence_dn):
areas[area] = dict()

View File

@ -24,7 +24,15 @@ class SearchController(AuthenticatedBaseController):
""" Affiche les résultats """
@expose("brie.templates.search.member")
def member(self, residence, name):
def member(self, residence, name, global_search = None):
if global_search is not None and self.user.groups.admin:
return self.member_global(residence, name)
else:
return self.member_local(residence, name)
#end if
#end def
def member_local(self, residence, name):
residence_dn = Residences.get_dn_by_name(self.user, residence)
members = Member.get_by_name(self.user, residence_dn, name)
@ -49,9 +57,16 @@ class SearchController(AuthenticatedBaseController):
}
#end def
@expose("brie.templates.search.member")
def email(self, residence, email):
def email(self, residence, email, global_search = None):
if global_search is not None and self.user.groups.admin:
self.email_global(residence, email)
else:
self.email_local(residence, email)
#end if
#end def
def email_local(self, residence, email):
residence_dn = Residences.get_dn_by_name(self.user, residence)
members = Member.get_by_email(self.user, residence_dn, email)
@ -186,7 +201,6 @@ class SearchController(AuthenticatedBaseController):
#end def
@expose("brie.templates.search.member_global")
def email_global(self, myresidence, email):
residences = Residences.get_residences(self.user)
members = []

View File

@ -30,48 +30,69 @@
</div>
</div>
<div class="section">
<span class="section_name show_section_name">Nom</span>
<span class="section_name show_section_name">RECHERCHES</span>
<div>
<span class="item_name">Nom</span>
<form action="/search/member/" method="post" class="inline_block">
<input type="hidden" name="residence" value="${residence}"/>
<input type="text" name="name"/>
<input type="submit" value="Search" class="button"/>
<input py:if="user.groups.admin"
type="submit" name="global_search"
value="Search global" class="button"/>
</form>
<form action="/search/member_global/" method="post" class="inline_block">
<input type="hidden" name="myresidence" value="${residence}"/>
<input type="text" name="name"/>
<input type="submit" value="Search global" class="button"/>
</form>
</div>
<div class="section">
<span class="section_name show_section_name">Email</span>
</div>
<div>
<span class="item_name">E-mail</span>
<form action="/search/email/" method="post" class="inline_block">
<input type="hidden" name="residence" value="${residence}"/>
<input type="text" name="email"/>
<input type="submit" value="Search" class="button"/>
<input py:if="user.groups.admin"
type="submit" name="global_search"
value="Search global" class="button"/>
</form>
<form action="/search/email_global/" method="post" class="inline_block">
<input type="hidden" name="myresidence" value="${residence}"/>
<input type="text" name="email"/>
<input type="submit" value="Search global" class="button"/>
</form>
</div>
<div class="section">
<span class="section_name show_section_name">Adresse mac</span>
</div>
<div>
<span class="item_name">Mac</span>
<form action="/search/mac/" method="post" class="inline_block">
<input type="hidden" name="residence" value="${residence}"/>
<input type="text" name="mac"/>
<input type="submit" value="Search" class="button"/>
</form>
</div>
<div class="section">
<span class="section_name show_section_name">Adresse IP</span>
</div>
<div>
<span class="item_name">IP</span>
<form action="/search/ip/" method="post" class="inline_block">
<input type="hidden" name="residence" value="${residence}"/>
<input type="text" name="ip"/>
<input type="submit" value="Search" class="button"/>
</form>
</div>
<!-- <form action="/search/member_global/" method="post" class="inline_block">
<input type="hidden" name="myresidence" value="${residence}"/>
<input type="text" name="name"/>
</form> -->
</div>
<!--
<div class="section">
<span class="section_name show_section_name">Email</span>
<form action="/search/email_global/" method="post" class="inline_block">
<input type="hidden" name="myresidence" value="${residence}"/>
<input type="text" name="email"/>
</form>
</div>
<div class="section">
<span class="section_name show_section_name">Adresse mac</span>
</div>
<div class="section">
<span class="section_name show_section_name">Adresse IP</span>
</div>
-->
<div py:if="user.groups.responsablereseau" class="section">
<span class="section_name show_section_name">DECONNEXION GLOBALE</span>
<div>
<span class="item_name"></span>
<form action="/edit/member/disconnectall/" method="post" class="inline_block">
<input type="hidden" name="residence" value="${residence}"/>
<input type="submit" value="Déconnexion globale" class="button"/>
@ -79,7 +100,8 @@
<form action="/edit/member/reconnectall/" method="post" class="inline_block">
<input type="hidden" name="residence" value="${residence}"/>
<input type="submit" value="Reconnexion globale" class="button"/>
</form>
</form>
</div>
</div>
</div>
</body>

View File

@ -37,7 +37,7 @@
<span class="section_name">PREVIEW</span>
</div>
<div>
<form method="post" action="/members/add/">
<form py:if="user.groups.admin" 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 />

View File

@ -10,7 +10,7 @@
<div class="navbar-inner">
<a class="brand" href="/">Brie d'Aurore</a>
<ul class="nav">
<li py:if="user.groups.admin"><a href="/rooms/index/${residence}">PIÈCES</a></li>
<li py:if="user.groups.admin or user.groups.admin_read"><a href="/rooms/index/${residence}">PIÈCES</a></li>
<li py:if="user.groups.admin"><a href="/members/index/${residence}">MEMBRES</a></li>
<li py:if="user.groups.admin"><a href="/registration/">INSCRIPTION</a></li>
<li py:if="user.groups.tresorier"><a href="/treasury/">TRÉSORIE</a></li>

View File

@ -11,7 +11,7 @@
<py:def function="member_view(member_ldap)">
<div class="section">
<span class="section_name show_section_name">${member_ldap.cn.first()}</span>
<a class="link_button some_margin" href="/edit/member/${residence}/${member_ldap.uid.first()}/">éditer</a>
<a py:if="user.groups.admin" class="link_button some_margin" href="/edit/member/${residence}/${member_ldap.uid.first()}/">éditer</a>
<div>
<div>
<span class="item_name">Fin de connexion</span>
@ -91,7 +91,7 @@
<py:def function="room_view(room, member_in = None)">
<div class="section">
<span class="section_name show_section_name">CHAMBRE ${room.cn.first()}</span>
<a class="link_button some_margin" href="/edit/room/index/${residence}/${room.uid.first()}/">éditer</a>
<a py:if="user.groups.admin" class="link_button some_margin" href="/edit/room/index/${residence}/${room.uid.first()}/">éditer</a>
<div>
<div py:if="member_in is not None">
<span class="item_name">Membre</span>