Browse Source

Have to be logged to change entities and their category

master
tr4ck3ur des JM2L 9 years ago
parent
commit
90b41400b6
1 changed files with 25 additions and 4 deletions
  1. +25
    -4
      jm2l/views.py

+ 25
- 4
jm2l/views.py View File

@@ -650,7 +650,7 @@ def exchange(request):

@view_config(route_name='sejour')
def sejour(request):
if request.user is None:
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
if request.method == 'POST':
@@ -659,7 +659,7 @@ def sejour(request):

@view_config(route_name='vote_logo')
def vote_logo(request):
if request.user is None:
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
else:
@@ -678,7 +678,7 @@ def vote_logo(request):

@view_config(route_name='jm2l', renderer="jm2l:templates/jm2l.mako")
def jm2l_page(request):
if request.user is None:
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
page = int(request.params.get('page', 1))
@@ -1001,6 +1001,9 @@ def show_event(request):
@view_config(route_name='link_event_user')
def link_event_user(request):
""" Get user and add it to current event """
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
year = int(request.matchdict.get('year', -1))
form = AddIntervenant(request.POST, meta={'csrf_context': request.session})
intervention = request.matchdict.get('intervention', None)
@@ -1023,6 +1026,9 @@ def link_event_user(request):
@view_config(route_name='link_event_tiers')
def link_event_tiers(request):
""" Create user if not exist, add it to current event """
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
year = int(request.matchdict.get('year', -1))
form = AddTiers(request.POST, meta={'csrf_context': request.session})
intervention = request.matchdict.get('intervention', None)
@@ -1049,6 +1055,9 @@ def link_event_tiers(request):

@view_config(route_name='edit_event', renderer="jm2l:templates/edit_event.mako")
def edit_event(request):
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
year = int(request.matchdict.get('year', -1))
event_id = request.matchdict.get('event_id')
intervention = request.matchdict.get('intervention', None)
@@ -1235,6 +1244,9 @@ def show_tiers(request):

@view_config(route_name='delete_entity')
def delete_tiers(request):
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
entity_id = request.matchdict.get('entity_id', None)
if entity_id:
if entity_id.isdigit():
@@ -1263,7 +1275,7 @@ def delete_tiers(request):
def edit_tiers(request):
entity_id = request.matchdict.get('entity_id', None)
TargetList = list()
if request.user is None:
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
entity_types = DBSession.query(TiersOpt.entity_type).group_by(TiersOpt.entity_type).all()
@@ -1355,6 +1367,9 @@ def edit_tiers(request):

@view_config(route_name='edit_entity_cat', renderer="jm2l:templates/edit_tiers_categ.mako")
def edit_tiers_category(request):
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
DicResult = dict()
ListChanges = list()
if request.method == 'POST':
@@ -1441,6 +1456,9 @@ def show_user(request):

#@view_config(route_name='link_user_entity')
def link_user_entity(request):
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
uid = int(request.matchdict.get('uid', -1))
year = int(request.matchdict.get('year', -1))
user_id = int(request.matchdict.get('uid', -1))
@@ -1451,6 +1469,9 @@ def link_user_entity(request):
#@view_config(route_name='link_role_entity')
def link_role_entity(request):
if request.user is None:
# Don't answer to users that aren't logged
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.')
uid = int(request.matchdict.get('uid', -1))
year = int(request.matchdict.get('year', -1))
role_id = int(request.matchdict.get('role_id', -1))


Loading…
Cancel
Save