Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
93805aed
Commit
93805aed
authored
Sep 14, 2017
by
Gabriel Detraz
Committed by
root
Sep 14, 2017
Browse files
Adpate l'autocapture au type de nas
parent
04ea76c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
users/models.py
View file @
93805aed
...
...
@@ -455,15 +455,14 @@ class User(AbstractBaseUser):
general_options
.
email_from
,
[
req
.
user
.
email
],
fail_silently
=
False
)
return
def
autoregister_machine
(
self
,
mac_address
,
nas_
ip
):
def
autoregister_machine
(
self
,
mac_address
,
nas_
type
):
all_machines
=
self
.
all_machines
()
options
,
created
=
OptionalMachine
.
objects
.
get_or_create
()
if
all_machines
.
count
()
>
options
.
max_lambdauser_interfaces
:
return
False
,
"Maximum de machines enregistrees atteinte"
nas_object
=
Nas
.
objects
.
filter
(
nas_type__in
=
MachineType
.
objects
.
filter
(
ip_type
=
nas_ip
.
ip_type
))
if
not
nas_object
:
if
not
nas_type
:
return
False
,
"Re2o ne sait pas à quel machinetype affecter cette machine"
machine_type_cible
=
nas_
object
.
first
()
.
machine_type
machine_type_cible
=
nas_
type
.
machine_type
try
:
machine_parent
=
Machine
()
machine_parent
.
user
=
self
...
...
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