Skip to content

Commit

Permalink
Only admin can create and edit organization,
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricbonhomme committed Feb 24, 2018
1 parent c471c92 commit f81d7d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/web/views/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from flask_login import login_required

from bootstrap import db, application
from web.views.common import admin_permission
from web.models import Organization, Icon
from web.forms import AddOrganizationForm

Expand Down Expand Up @@ -48,6 +49,7 @@ def recent_releases(organization_name=None):
@organization_bp.route('/create', methods=['GET'])
@organization_bp.route('/edit/<int:organization_id>', methods=['GET'])
@login_required
@admin_permission.require(http_exception=403)
def form(organization_id=None):
action = "Add an organization"
head_titles = [action]
Expand All @@ -71,6 +73,7 @@ def form(organization_id=None):
@organization_bp.route('/create', methods=['POST'])
@organization_bp.route('/edit/<int:organization_id>', methods=['POST'])
@login_required
@admin_permission.require(http_exception=403)
def process_form(organization_id=None):
form = AddOrganizationForm()

Expand All @@ -79,7 +82,6 @@ def process_form(organization_id=None):
print(organization_id)
if organization_id is not None:
organization = Organization.query.filter(Organization.id == organization_id).first()

# Logo
f = form.logo.data
if f:
Expand Down

0 comments on commit f81d7d6

Please sign in to comment.