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
R
re2o
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
95dc427d
Commit
95dc427d
authored
Jul 29, 2018
by
chirac
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'Dname'
# Conflicts: # re2o/templatetags/acl.py
parents
c977ecca
9be8ca1c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
128 additions
and
121 deletions
+128
-121
cotisations/templates/cotisations/aff_article.html
cotisations/templates/cotisations/aff_article.html
+3
-19
cotisations/templates/cotisations/aff_paiement.html
cotisations/templates/cotisations/aff_paiement.html
+1
-16
machines/templates/machines/aff_extension.html
machines/templates/machines/aff_extension.html
+0
-1
machines/templates/machines/aff_iptype.html
machines/templates/machines/aff_iptype.html
+0
-1
machines/templates/machines/aff_nas.html
machines/templates/machines/aff_nas.html
+0
-1
machines/templates/machines/aff_service.html
machines/templates/machines/aff_service.html
+0
-1
re2o/templatetags/acl.py
re2o/templatetags/acl.py
+25
-66
users/templates/users/profil.html
users/templates/users/profil.html
+95
-13
users/views.py
users/views.py
+4
-3
No files found.
cotisations/templates/cotisations/aff_article.html
View file @
95dc427d
...
...
@@ -30,26 +30,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table
class=
"table table-striped"
>
<thead>
<tr>
<td>
{{ article.name }}
</td>
<td>
{{ article.prix }}
</td>
<td>
{{ article.type_cotisation }}
</td>
<td>
{{ article.duration }}
</td>
<td>
{{ article.type_user }}
</td>
<td>
{{ article.available_for_everyone }}
</td>
<td
class=
"text-right"
>
{% can_edit article %}
<a
class=
"btn btn-primary btn-sm"
role=
"button"
title=
"{% trans "
Edit
"
%}"
href=
"{% url 'cotisations:edit-article' article.id %}"
>
<i
class=
"fa fa-edit"
></i>
</a>
{% acl_end %}
{% history_button article %}
</td>
<th>
{% trans "Article" %}
</th>
<th>
{% trans "Price" %}
</th>
<th>
{% trans "Cotisation type" %}
</th>
<th>
{% trans "Duration (month)" %}
</th>
<th>
{% trans "Concerned users" %}
</th>
<th>
{% trans "Available for everyone" %}
</th>
<th>
{% trans "Available for everyone"
| tick
%}
</th>
<th></th>
</tr>
</thead>
...
...
@@ -60,16 +46,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>
{{ article.type_cotisation }}
</td>
<td>
{{ article.duration }}
</td>
<td>
{{ article.type_user }}
</td>
<td>
{{ article.available_for_everyone
|tick
}}
</td>
<td>
{{ article.available_for_everyone }}
</td>
<td
class=
"text-right"
>
{% can_edit article %}
<a
class=
"btn btn-primary btn-sm"
role=
"button"
title=
"{% trans "
Edit
"
%}"
href=
"{% url 'cotisations:edit-article' article.id %}"
>
<i
class=
"fa fa-edit"
></i>
</a>
{% acl_end %}
<a
class=
"btn btn-info btn-sm"
role=
"button"
title=
"{% trans "
Historique
"
%}"
href=
"{% url 'cotisations:history' 'article' article.id %}"
>
<i
class=
"fa fa-history"
></i>
</a>
{% history_button article %}
</td>
</tr>
{% endfor %}
...
...
cotisations/templates/cotisations/aff_paiement.html
View file @
95dc427d
...
...
@@ -30,19 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<table
class=
"table table-striped"
>
<thead>
<tr>
<td>
{{ paiement.moyen }}
</td>
<td>
{{ paiement.available_for_everyone }}
</td>
<td>
{{paiement.get_payment_method_name}}
</td>
<td
class=
"text-right"
>
{% can_edit paiement %}
<a
class=
"btn btn-primary btn-sm"
role=
"button"
title=
"{% trans "
Edit
"
%}"
href=
"{% url 'cotisations:edit-paiement' paiement.id %}"
>
<i
class=
"fa fa-edit"
></i>
</a>
{% acl_end %}
{% history_button paiement %}
</td>
<th>
{% trans "Payment type" %}
</th>
<th>
{% trans "Is available for everyone" %}
</th>
<th>
{% trans "Custom payment method" %}
</th>
...
...
@@ -62,9 +49,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i
class=
"fa fa-edit"
></i>
</a>
{% acl_end %}
<a
class=
"btn btn-info btn-sm"
role=
"button"
title=
"{% trans "
Historique
"
%}"
href=
"{% url 'cotisations:history' 'paiement' paiement.id %}"
>
<i
class=
"fa fa-history"
></i>
</a>
{% history_button paiement %}
</td>
</tr>
{% endfor %}
...
...
machines/templates/machines/aff_extension.html
View file @
95dc427d
...
...
@@ -54,7 +54,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
{% acl_end %}
{% history_button extension %}
{% include 'buttons/history.html' with href='machines:history' name='extension' id=extension.id %}
</td>
</tr>
{% endfor %}
...
...
machines/templates/machines/aff_iptype.html
View file @
95dc427d
...
...
@@ -55,7 +55,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
{% acl_end %}
{% history_button type %}
{% include 'buttons/history.html' with href='machines:history' name='iptype' id=type.id %}
</td>
</tr>
{% endfor %}
...
...
machines/templates/machines/aff_nas.html
View file @
95dc427d
...
...
@@ -49,7 +49,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% acl_end %}
{% history_button nas %}
{% include 'buttons/history.html' with href='machines:history' name='nas' id=nas.id %}
</td>
</tr>
{% endfor %}
...
...
machines/templates/machines/aff_service.html
View file @
95dc427d
...
...
@@ -47,7 +47,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% acl_end %}
{% history_button service %}
{% include 'buttons/history.html' with href='machines:history' name='service' id=service.id %}
</td>
</tr>
{% endfor %}
...
...
re2o/templatetags/acl.py
View file @
95dc427d
...
...
@@ -74,83 +74,42 @@ import sys
from
django
import
template
from
django.template.base
import
Node
,
NodeList
from
django.contrib.contenttypes.models
import
ContentType
import
cotisations
import
machines
import
preferences
import
topologie
import
users
register
=
template
.
Library
()
MODEL_NAME
=
{
# cotisations
'Facture'
:
cotisations
.
models
.
Facture
,
'Vente'
:
cotisations
.
models
.
Vente
,
'Article'
:
cotisations
.
models
.
Article
,
'Banque'
:
cotisations
.
models
.
Banque
,
'Paiement'
:
cotisations
.
models
.
Paiement
,
'Cotisation'
:
cotisations
.
models
.
Cotisation
,
# machines
'Machine'
:
machines
.
models
.
Machine
,
'MachineType'
:
machines
.
models
.
MachineType
,
'IpType'
:
machines
.
models
.
IpType
,
'Vlan'
:
machines
.
models
.
Vlan
,
'Nas'
:
machines
.
models
.
Nas
,
'SOA'
:
machines
.
models
.
SOA
,
'Extension'
:
machines
.
models
.
Extension
,
'Mx'
:
machines
.
models
.
Mx
,
'Ns'
:
machines
.
models
.
Ns
,
'Txt'
:
machines
.
models
.
Txt
,
'DName'
:
machines
.
models
.
DName
,
'Srv'
:
machines
.
models
.
Srv
,
'Interface'
:
machines
.
models
.
Interface
,
'Domain'
:
machines
.
models
.
Domain
,
'IpList'
:
machines
.
models
.
IpList
,
'Ipv6List'
:
machines
.
models
.
Ipv6List
,
'machines.Service'
:
machines
.
models
.
Service
,
'Service_link'
:
machines
.
models
.
Service_link
,
'OuverturePortList'
:
machines
.
models
.
OuverturePortList
,
'OuverturePort'
:
machines
.
models
.
OuverturePort
,
# preferences
'OptionalUser'
:
preferences
.
models
.
OptionalUser
,
'OptionalMachine'
:
preferences
.
models
.
OptionalMachine
,
'OptionalTopologie'
:
preferences
.
models
.
OptionalTopologie
,
'GeneralOption'
:
preferences
.
models
.
GeneralOption
,
'preferences.Service'
:
preferences
.
models
.
Service
,
'AssoOption'
:
preferences
.
models
.
AssoOption
,
'MailMessageOption'
:
preferences
.
models
.
MailMessageOption
,
# topologie
'Stack'
:
topologie
.
models
.
Stack
,
'Switch'
:
topologie
.
models
.
Switch
,
'AccessPoint'
:
topologie
.
models
.
AccessPoint
,
'ModelSwitch'
:
topologie
.
models
.
ModelSwitch
,
'ConstructorSwitch'
:
topologie
.
models
.
ConstructorSwitch
,
'Port'
:
topologie
.
models
.
Port
,
'Room'
:
topologie
.
models
.
Room
,
'Building'
:
topologie
.
models
.
Building
,
'SwitchBay'
:
topologie
.
models
.
SwitchBay
,
# users
'User'
:
users
.
models
.
User
,
'Adherent'
:
users
.
models
.
Adherent
,
'Club'
:
users
.
models
.
Club
,
'ServiceUser'
:
users
.
models
.
ServiceUser
,
'School'
:
users
.
models
.
School
,
'ListRight'
:
users
.
models
.
ListRight
,
'ListShell'
:
users
.
models
.
ListShell
,
'Ban'
:
users
.
models
.
Ban
,
'Whitelist'
:
users
.
models
.
Whitelist
,
}
def
get_model
(
model_name
):
"""Retrieve the model object from its name"""
splitted
=
model_name
.
split
(
'.'
)
if
len
(
splitted
)
>
1
:
try
:
app_label
,
name
=
splitted
except
ValueError
:
raise
template
.
TemplateSyntaxError
(
"%r is an inconsistent model name"
%
model_name
)
else
:
app_label
,
name
=
None
,
splitted
[
0
]
try
:
return
MODEL_NAME
[
model_name
]
except
KeyError
:
if
app_label
is
not
None
:
content_type
=
ContentType
.
objects
.
get
(
model
=
name
.
lower
(),
app_label
=
app_label
)
else
:
content_type
=
ContentType
.
objects
.
get
(
model
=
name
.
lower
())
except
ContentType
.
DoesNotExist
:
raise
template
.
TemplateSyntaxError
(
"%r is not a valid model for an acl tag"
%
model_name
)
except
ContentType
.
MultipleObjectsReturned
:
raise
template
.
TemplateSyntaxError
(
"More than one model found for %r. Try with `app.model`."
%
model_name
)
return
content_type
.
model_class
()
def
get_callback
(
tag_name
,
obj
=
None
):
...
...
users/templates/users/profil.html
View file @
95dc427d
...
...
@@ -28,19 +28,101 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load logs_extra %}
{% block title %}Profil{% endblock %}
{% block content %}
<h2>
{{ users.surname }} {{users.name}}
</h2>
<p>
Vous êtes {% if users.end_adhesion != None %}
<span
class=
"label label-success"
>
un {{ users.class_name | lower}}
</span>
{% else %}
<span
class=
"label label-danger"
>
non adhérent
</span>
{% endif %} et votre connexion est {% if users.has_access %}
<span
class=
"label label-success"
>
active
</span>
{% else %}
<span
class=
"label label-danger"
>
désactivée
</span>
{% endif %}.
</p>
{% if user_solde %}
<p>
Votre solde est de
<span
class=
"badge"
>
{{ users.solde }}€
</span>
.
<a
class=
"btn btn-primary btn-sm"
role=
"button"
href=
"{% url 'cotisations:credit-solde' users.pk%}"
>
<i
class=
"fa fa-euro-sign"
></i>
Recharger
</a>
</p>
{% endif %}
<div
align=
"center"
>
<h2>
Bienvenue {{users.name}} {{ users.surname }}
</h2>
</div>
<div
class=
"dashboard_container"
>
<div
class=
"row"
>
{% if solde_activated %}
<div
class=
"col-sm-6 col-md-4"
>
{% else %}
<div
class=
"col-sm-6 col-md-6"
>
{% endif %}
<div
class=
"col-12"
>
{% if users.is_ban%}
<div
class=
"panel panel-danger"
>
<div
class=
"panel-heading dashboard"
>
Votre compte est banni
</div>
<div
class=
"panel-body dashboard"
>
<i
class=
"text-danger"
>
Fin du ban : {{user.end_ban|date:"d M Y"}}
</i>
</div>
</div>
{% elif not users.is_adherent%}
<div
class=
"panel panel-danger"
>
<div
class=
"panel-heading dashboard"
>
Non Connécté
</div>
<div
class=
"panel-body dashboard"
>
<a
class=
"btn btn-danger btn-sm"
role=
"button"
href=
"{% url 'cotisations:credit-solde' users.id %}"
>
<i
class=
"fas fa-sign-in-alt"
></i>
Adhérer
</a>
</div>
{% else %}
<div
class=
"panel panel-success"
>
<div
class=
"panel-heading dashboard"
>
Connécté
</div>
<div
class=
"panel-body dashboard"
>
<i
class=
"text-success"
>
Fin de connexion: {{user.end_adhesion|date:"d M Y"}}
</i>
</div>
</div>
{% endif %}
</div>
</div>
{% if solde_activated %}
<div
class=
"col-sm-6 col-md-4"
>
<div
class=
"col-12"
>
<div
class=
"col-12"
>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading dashboard"
data-parent=
"#accordion"
data-toggle=
"collapse"
data-target=
"#collapse4"
>
{{user.solde}}
<i
class=
"fas fa-euro-sign"
></i>
</div>
<div
class=
"panel-body dashboard"
>
<a
class=
"btn btn-primary btn-sm"
role=
"button"
href=
"{% url 'cotisations:credit-solde' users.id %}"
>
<i
class=
"fa fa-euro-sign"
></i>
Modifier le solde
</a>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% if solde_activated %}
<div
class=
"col-sm-6 col-md-4"
>
{% else %}
<div
class=
"col-sm-6 col-md-6"
>
{% endif %}
<div
class=
"col-12"
>
{% if nb_machines %}
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading dashboard"
data-parent=
"#accordion"
data-toggle=
"collapse"
data-target=
"#collapse3"
>
<span
class=
"badge"
>
{{nb_machines}}
</span>
Machines
<i
class=
"fa fa-desktop"
></i>
</div>
<div
class=
"panel-body dashboard"
>
<a
class=
"btn btn-primary btn-sm"
role=
"button"
href=
"{% url 'machines:new-machine' users.id %}"
>
<i
class=
"fa fa-desktop"
></i>
Ajouter une machine
</a>
</div>
</div>
{% else %}
<div
class=
"panel panel-warning"
>
<div
class=
"panel-heading dashboard"
>
Aucune machine
</div>
<div
class=
"panel-body dashboard"
>
<a
class=
"btn btn-warning btn-sm"
role=
"button"
href=
"{% url 'machines:new-machine' users.id %}"
>
<i
class=
"fa fa-desktop"
></i>
Ajouter une machine
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
<div
class=
"panel-group"
id=
"accordion"
>
<div
class=
"panel panel-default"
>
...
...
users/views.py
View file @
95dc427d
...
...
@@ -51,7 +51,7 @@ from reversion import revisions as reversion
from
cotisations.models
import
Facture
,
Paiement
from
machines.models
import
Machine
from
preferences.models
import
General
Option
from
preferences.models
import
OptionalUser
,
GeneralOption
,
Asso
Option
from
re2o.views
import
form
from
re2o.utils
import
(
all_has_access
,
...
...
@@ -112,8 +112,7 @@ def new_user(request):
GTU_sum_up
=
GeneralOption
.
get_cached_value
(
'GTU_sum_up'
)
GTU
=
GeneralOption
.
get_cached_value
(
'GTU'
)
if
user
.
is_valid
():
user
=
user
.
save
(
commit
=
False
)
user
.
save
()
user
=
user
.
save
()
user
.
reset_passwd_mail
(
request
)
messages
.
success
(
request
,
"L'utilisateur %s a été crée, un mail
\
pour l'initialisation du mot de passe a été envoyé"
%
user
.
pseudo
)
...
...
@@ -914,6 +913,8 @@ def profil(request, users, **_kwargs):
'ban_list'
:
bans
,
'white_list'
:
whitelists
,
'user_solde'
:
user_solde
,
'solde_activated'
:
Paiement
.
objects
.
filter
(
is_balance
=
True
).
exists
(),
'asso_name'
:
AssoOption
.
objects
.
first
().
name
}
)
...
...
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