Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
scripts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Leo Colisson
scripts
Commits
0b9d0615
Commit
0b9d0615
authored
Feb 05, 2017
by
Hamza Dely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[gest_crans] Patches en pagaille
parent
c9560ef1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
30 deletions
+36
-30
gestion/cransdialog/lc.py
gestion/cransdialog/lc.py
+4
-3
gestion/cransdialog/machine.py
gestion/cransdialog/machine.py
+24
-19
gestion/cransdialog/proprio.py
gestion/cransdialog/proprio.py
+8
-8
No files found.
gestion/cransdialog/lc.py
View file @
0b9d0615
...
...
@@ -103,8 +103,8 @@ class Dialog(CPS.Dialog):
else
:
sys
.
stderr
.
write
(
u
"%s ne possède aucun des droits :
\n
"
" * %s
\n
"
"nécessaire pour utiliser ce programme
\n
"
%
(
u
" * %s
\n
"
u
"nécessaire pour utiliser ce programme
\n
"
%
(
self
.
conn
.
current_login
,
'
\n
* '
.
join
(
allowed_right
)
)
...
...
@@ -153,7 +153,8 @@ class Dialog(CPS.Dialog):
timeout
=
self
.
timeout
,
list_height
=
7
,
choices
=
choices
,
title
=
title
)
title
=
title
)
def
todo
(
values
,
obj
,
attribs
,
cont
):
# On met à jour chaque attribut si sa valeur à changé
...
...
gestion/cransdialog/machine.py
View file @
0b9d0615
...
...
@@ -39,12 +39,19 @@ class Dialog(certificat.Dialog, blacklist.Dialog):
"""
a
=
attributs
# Quel sont les attributs ldap dont on veut afficher et la taille du champs d'édition correspondant
to_display
=
[(
a
.
host
,
40
),
(
a
.
macAddress
,
17
),
(
a
.
ipHostNumber
,
15
)]
to_display
=
[(
a
.
host
,
40
),
(
a
.
macAddress
,
17
),
(
a
.
ipHostNumber
,
15
)]
to_display_port
=
[(
a
.
portTCPout
,
50
),
(
a
.
portTCPin
,
50
),
(
a
.
portUDPout
,
50
),
(
a
.
portUDPin
,
50
)]
to_display_port
=
[(
a
.
portTCPout
,
50
),
(
a
.
portTCPin
,
50
),
(
a
.
portUDPout
,
50
),
(
a
.
portUDPin
,
50
)]
to_display_borne
=
[(
a
.
canal
,
10
),
(
a
.
puissance
,
10
),
(
a
.
positionBorne
,
50
),
(
a
.
prise
,
10
)]
to_display_borne
=
[(
a
.
canal
,
10
),
(
a
.
puissance
,
10
),
(
a
.
positionBorne
,
50
),
(
a
.
prise
,
10
)]
to_display_machine_crans
=
[(
a
.
prise
,
10
)]
...
...
@@ -198,7 +205,7 @@ class Dialog(certificat.Dialog, blacklist.Dialog):
values
=
[
v
for
v
in
values
.
split
(
separateur
)
if
v
]
# Pour host, on fait quelques vérification de syntaxe
if
a
.
ldap_name
==
'host'
:
attrs
[
a
.
ldap_name
]
=
check_host
(
values
,
objectClass
,
realm
)
attrs
[
a
.
ldap_name
]
=
check_host
(
values
,
objectClass
,
realm
,
proprio
)
else
:
attrs
[
a
.
ldap_name
]
=
values
# Soit on édite une machine existante
...
...
@@ -282,7 +289,7 @@ class Dialog(certificat.Dialog, blacklist.Dialog):
"""Raccourci vers edit_blacklist spécifique aux machines"""
return
self
.
edit_blacklist
(
obj
=
machine
,
title
=
"Éditions
des blacklist de la machine %s"
%
machine
[
'host'
][
0
],
title
=
u
"Édition
des blacklist de la machine %s"
%
machine
[
'host'
][
0
],
update_obj
=
'machine'
,
cont
=
cont
)
...
...
@@ -293,7 +300,7 @@ class Dialog(certificat.Dialog, blacklist.Dialog):
obj
=
machine
,
update_obj
=
'machine'
,
attr
=
attr
,
title
=
"Modification de la machine %s"
%
machine
[
'host'
][
0
],
title
=
u
"Modification de la machine %s"
%
machine
[
'host'
][
0
],
cont
=
cont
)
...
...
@@ -308,13 +315,11 @@ class Dialog(certificat.Dialog, blacklist.Dialog):
return
self
.
edit_boolean_attributs
(
obj
=
machine
,
attribs
=
attribs
,
title
=
"Édition des attributs booléen de la machine %s"
%
machine
[
'host'
][
0
],
title
=
"Édition des attributs booléen
s
de la machine %s"
%
machine
[
'host'
][
0
],
update_obj
=
'machine'
,
cont
=
cont
)
def
modif_machine
(
self
,
cont
,
machine
=
None
,
tag
=
None
):
"""
Permet d'éditer une machine. Si fournie en paramètre on éditer en place,
...
...
@@ -346,39 +351,39 @@ class Dialog(certificat.Dialog, blacklist.Dialog):
}
menu
=
{
'Information'
:
{
'text'
:
"Modifier le nom de machine, l'IP, adresse MAC"
,
'text'
:
u
"Modifier le nom de machine, l'IP, adresse MAC"
,
"callback"
:
self
.
machine_information
},
'Autre'
:
{
'text'
:
"Modifier les attribut booléen comme actif/inactif ou dnsIpv6"
,
'text'
:
u
"Modifier les attribut booléen comme actif/inactif ou dnsIpv6"
,
"callback"
:
self
.
modif_machine_boolean
},
'Blackliste'
:
{
'text'
:
'Modifier les blacklist de la machine'
,
'text'
:
u
'Modifier les blacklist de la machine'
,
'callback'
:
self
.
modif_machine_blacklist
},
'Certificat'
:
{
'text'
:
'Modifier les certificats de la machine'
,
'text'
:
u
'Modifier les certificats de la machine'
,
'callback'
:
self
.
modif_machine_certificat
},
'Exemption'
:
{
'text'
:
"Modifier la liste d'exemption d'upload de la machine"
,
'text'
:
u
"Modifier la liste d'exemption d'upload de la machine"
,
'attribut'
:
attributs
.
exempt
},
'Alias'
:
{
'text'
:
'Créer ou supprimer un alias de la machine'
,
'text'
:
u
'Créer ou supprimer un alias de la machine'
,
'attribut'
:
attributs
.
hostAlias
},
'Remarques'
:
{
'text'
:
'Ajouter ou supprimer une remarque de la machine'
,
'text'
:
u
'Ajouter ou supprimer une remarque de la machine'
,
'attribut'
:
attributs
.
info
},
'SshKey'
:
{
'text'
:
'Ajouter ou supprimer une clef ssh pour la machine'
,
'text'
:
u
'Ajouter ou supprimer une clef ssh pour la machine'
,
'attribut'
:
attributs
.
sshFingerprint
},
'Supprimer'
:
{
'text'
:
'Supprimer la machine'
,
'text'
:
u
'Supprimer la machine'
,
'callback'
:
self
.
delete_machine
},
}
...
...
gestion/cransdialog/proprio.py
View file @
0b9d0615
...
...
@@ -72,10 +72,10 @@ L'adhérent devra impérativement consulter l'adresse mail associée
def
get_login
(
proprio
,
self_cont
,
cont
):
# Essaye-t-on de forcer le login à utiliser
nom
=
unicodedata
.
normalize
(
'NFKD'
,
proprio
[
'nom'
][
0
]
).
encode
(
'ascii'
,
'ignore'
).
lower
().
replace
(
' '
,
'-'
)
nom
=
unicodedata
.
normalize
(
'NFKD'
,
unicode
(
proprio
[
u
'nom'
][
0
])
).
encode
(
'ascii'
,
'ignore'
).
lower
().
replace
(
' '
,
'-'
)
login_crans
=
nom
if
proprio
.
get
(
'prenom'
,
[
False
])[
0
]:
prenom
=
unicodedata
.
normalize
(
'NFKD'
,
proprio
[
'prenom'
][
0
]
).
encode
(
'ascii'
,
'ignore'
).
lower
().
replace
(
' '
,
'-'
)
prenom
=
unicodedata
.
normalize
(
'NFKD'
,
unicode
(
proprio
[
'prenom'
][
0
])
).
encode
(
'ascii'
,
'ignore'
).
lower
().
replace
(
' '
,
'-'
)
baselogin
=
nom
for
rang
,
let
in
enumerate
(
prenom
):
if
self
.
conn
.
search
(
u
'uid=%s'
%
login_crans
)
==
[]:
...
...
@@ -1288,7 +1288,7 @@ Repasser le solde à 0€ pour supprimer le compte.""" % proprio.get('solde', [0
if
proprio
:
attrs
=
dict
((
k
,
[
unicode
(
a
)
for
a
in
at
])
for
(
k
,
at
)
in
proprio
.
items
())
if
'cransAccount'
in
proprio
[
'objectClass'
]:
#input_type[attributs.mail] =
attributs.mail.max_length
#input_type[attributs.mail] =
54
to_display
.
append
((
attributs
.
mailExt
,
30
))
else
:
attrs
=
{}
...
...
@@ -1298,7 +1298,7 @@ Repasser le solde à 0€ pour supprimer le compte.""" % proprio.get('solde', [0
timeout
=
self
.
timeout
,
title
=
"Création d'un utilisateur"
,
width
=
50
)
==
self
.
dialog
.
OK
:
#input_type[attributs.mail] =
attributs.mail.max_length
#input_type[attributs.mail] =
54
make_compte_crans
=
True
to_display
.
append
((
attributs
.
mailExt
,
30
))
else
:
...
...
@@ -1373,16 +1373,16 @@ Repasser le solde à 0€ pour supprimer le compte.""" % proprio.get('solde', [0
1
,
fields_attrs
.
get
(
a
,
separateur
.
join
(
attrs
.
get
(
a
.
ldap_name
,
[
a
.
default
]
if
a
.
default
else
[]))),
num
+
1
,
#max(map(lambda x: len(x[0].legend))) + 3,
l
+
1
,
min
(
a
.
max_length
,
40
),
l
,
input_type
.
get
(
a
,
input_type
[
'default'
])
)
for
num
,
(
a
,
l
)
in
enumerate
(
to_display
)
]
(
code
,
tags
)
=
self
.
dialog
.
form
(
""
,
fields
,
(
code
,
tags
)
=
self
.
dialog
.
mixed
form
(
text
=
""
,
elements
=
fields
,
timeout
=
self
.
timeout
,
height
=
0
,
width
=
0
,
form_height
=
0
,
title
=
"Création d'un utilisateur"
if
proprio
is
None
else
"Édition des informations de %s %s"
%
(
proprio
.
get
(
'prenom'
,
[
''
])[
0
],
proprio
[
'nom'
][
0
]),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment