Exemplo n.º 1
0
 def wrapper(*args, **kwargs):
     if not current_user.is_superuser:
         project = kwargs.get('project', None)
         if project:
             user_weight = current_user.project_weight(project)
         else:
             user_weight = 0
         required_weight = Permissions.get_weight(permission)
         if user_weight < required_weight:
             return render_template('not_permission.html')
     return func(*args, **kwargs)
Exemplo n.º 2
0
def project_view(project):
    user_weight = current_user.project_weight(project)
    if user_weight == Permissions.weights[Permissions.REPORTS_ONLY]:
        return redirect('/report/project/{}/'.format(project))
    else:
        return redirect('/project/{}/suites/'.format(project))