ajout du check telephone + fast mac sur edit + check machine_membre_disable en GUI
This commit is contained in:
parent
6c29303f7d
commit
6d47839f14
@ -68,10 +68,10 @@ class MemberAddController(AuthenticatedRestController):
|
||||
|
||||
""" Fonction de gestion de requete post sur le controller d'ajout """
|
||||
@expose()
|
||||
def post(self, residence, prenom, nom, mail, go_redirect = True):
|
||||
def post(self, residence, prenom, nom, mail, phone, go_redirect = True):
|
||||
|
||||
member_uid = Translations.to_uid(prenom, nom)
|
||||
member = Member.entry_attr(member_uid, prenom, nom, mail, -1)
|
||||
member = Member.entry_attr(member_uid, prenom, nom, mail, phone, -1)
|
||||
|
||||
residence_dn = Residences.get_dn_by_name(self.user, residence)
|
||||
|
||||
@ -186,7 +186,7 @@ class MemberModificationController(AuthenticatedRestController):
|
||||
#end def
|
||||
|
||||
@expose()
|
||||
def post(self, residence, member_uid, sn, givenName, mail, comment):
|
||||
def post(self, residence, member_uid, sn, givenName, mail, phone, comment):
|
||||
residence_dn = Residences.get_dn_by_name(self.user, residence)
|
||||
member = Member.get_by_uid(self.user, residence_dn, member_uid)
|
||||
|
||||
@ -200,6 +200,7 @@ class MemberModificationController(AuthenticatedRestController):
|
||||
member.givenName.replace(member.givenName.first(), givenName)
|
||||
member.cn.replace(member.cn.first(), givenName + " " + sn)
|
||||
member.mail.replace(member.mail.first(), mail)
|
||||
member.mobile.replace(member.mobile.first(), phone)
|
||||
if comment != "":
|
||||
member.get("x-comment").replace(member.get("x-comment").first(), comment)
|
||||
|
||||
|
@ -128,7 +128,7 @@ class NewRegistrationController(AuthenticatedRestController):
|
||||
self.member_edit_controller = member_edit_controller
|
||||
|
||||
@expose()
|
||||
def post(self, residence, sn, givenName, mail,
|
||||
def post(self, residence, sn, givenName, mail, phone,
|
||||
room_uid, first_machine_name, first_machine_mac,
|
||||
next_end, extra_name
|
||||
):
|
||||
@ -138,7 +138,7 @@ class NewRegistrationController(AuthenticatedRestController):
|
||||
self.member_edit_controller.room.move.user = self.user
|
||||
self.member_edit_controller.cotisation.add.user = self.user
|
||||
|
||||
member_uid = self.member_edit_controller.add.post(residence, givenName, sn, mail, go_redirect = False)
|
||||
member_uid = self.member_edit_controller.add.post(residence, givenName, sn, mail, phone, go_redirect = False)
|
||||
member = Member.get_by_uid(self.user, self.user.residence_dn, member_uid)
|
||||
|
||||
if member is not None:
|
||||
|
@ -8,7 +8,7 @@ import datetime
|
||||
class Member(object):
|
||||
|
||||
@staticmethod
|
||||
def entry_attr(uid, prenom, nom, mail, uid_number):
|
||||
def entry_attr(uid, prenom, nom, mail, phone, uid_number):
|
||||
return {
|
||||
"objectClass" : ["top", "person", "organizationalPerson", "inetOrgPerson", "pacatnetMember", "pykotaAccount", "posixAccount"],
|
||||
"uid" :uid.encode("utf-8"),
|
||||
@ -16,6 +16,7 @@ class Member(object):
|
||||
"sn" : (nom.upper()).encode("utf-8"),
|
||||
"givenName" : (prenom).encode("utf-8"),
|
||||
"uidNumber" : str(uid_number),
|
||||
"mobile" : str(phone),
|
||||
"gidNumber" : "10000",
|
||||
"homeDirectory" : ("/net/home/" + uid).encode("utf-8"),
|
||||
"mail" : mail.encode("utf-8"),
|
||||
@ -181,11 +182,16 @@ class Machine(object):
|
||||
dns = user_session.ldap_bind.search_first(result.dn, "(objectClass=dlzGenericRecord)")
|
||||
if dhcp is not None and dns is not None:
|
||||
mac = dhcp.dhcpHWAddress.first().replace("ethernet ", "")
|
||||
disabled = ""
|
||||
if dhcp.uid.first() == "machine_membre_disabled":
|
||||
disabled = "desactive"
|
||||
#end if
|
||||
machines.append(
|
||||
(
|
||||
result.cn.first(),
|
||||
mac,
|
||||
dns.dlzData.first()
|
||||
dns.dlzData.first(),
|
||||
disabled
|
||||
) #tuple
|
||||
)
|
||||
#end if
|
||||
|
@ -5,6 +5,7 @@
|
||||
<head>
|
||||
<link type="text/css" rel="Stylesheet" href="/css/common.css" />
|
||||
<link type="text/css" rel="Stylesheet" href="/css/show.css" />
|
||||
<script src="/js/mac_address_changer.js" />
|
||||
<xi:include href="common-css-header.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -29,6 +29,10 @@
|
||||
<span class="item_name">E-mail</span>
|
||||
<input type="text" name="mail" value="${member_ldap.mail.first('')}" />
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">Téléphone</span>
|
||||
<input type="text" name="phone" value="${member_ldap.mobile.first('')}" />
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">Commentaire</span>
|
||||
<input type="text" name="comment" value="${member_ldap.get('x-comment').first('')}" />
|
||||
@ -55,7 +59,7 @@
|
||||
<div>
|
||||
<form action="/edit/machine/add/" method="post">
|
||||
<input type="text" name="name" placeholder="nom de la machine" class="item_name"/>
|
||||
<input type="text" name="mac" placeholder="adresse mac" />
|
||||
<input type="text" name="mac" onkeyup="mac_address_correcter()" id="mac_adress_input" placeholder="adresse mac" />
|
||||
<input type="hidden" name="residence" value="${residence}"/>
|
||||
<input type="hidden" name="member_uid" value="${member_ldap.uid.first()}"/>
|
||||
<input type="submit" value="ajouter" class="button"/>
|
||||
|
@ -26,6 +26,10 @@
|
||||
<span class="item_name">E-mail</span>
|
||||
<input type="text" name="mail" value="" />
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">Téléphone</span>
|
||||
<input type="text" name="phone" value="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
|
@ -24,6 +24,10 @@
|
||||
<span class="item_name">E-mail</span>
|
||||
<span>${member_ldap.mail.first('')}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">Téléphone</span>
|
||||
<span>${member_ldap.mobile.first('')}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">Certificat</span>
|
||||
<py:with vars="certif = member_ldap.get('x-certificatGiven')">
|
||||
@ -73,9 +77,13 @@
|
||||
</div>
|
||||
<div class="section">
|
||||
<span class="section_name show_section_name">MACHINES</span>
|
||||
<div py:for="name, mac, ip in machines">
|
||||
<div py:for="name, mac, ip, disable in machines">
|
||||
<span class="item_name">${name}</span>
|
||||
<span>${mac} : ${ip}</span>
|
||||
<py:choose test="">
|
||||
<span py:when="disable == ''"></span>
|
||||
<span py:otherwise="" style="color:red;"> >> Machine désactivée</span>
|
||||
</py:choose>
|
||||
</div>
|
||||
</div>
|
||||
</py:def>
|
||||
|
Loading…
Reference in New Issue
Block a user