Hide Attract links & project settings for non-attract-users

This commit is contained in:
2017-06-15 16:26:17 +02:00
parent 62795b4007
commit c69aeb03dc
2 changed files with 10 additions and 0 deletions

View File

@@ -170,9 +170,16 @@ class AttractExtension(PillarExtension):
if not self.is_attract_project(project):
return ''
if not self.auth.current_user_may(auth.Actions.VIEW):
return ''
return flask.render_template('attract/sidebar.html',
project=project)
@property
def has_project_settings(self) -> bool:
return self.auth.current_user_is_attract_user()
def project_settings(self, project: pillarsdk.Project, **template_args: dict) -> flask.Response:
"""Renders the project settings page for this extension.

View File

@@ -171,6 +171,9 @@ def project_settings(project: pillarsdk.Project, **template_args: dict):
from . import EXTENSION_NAME
if not current_attract.auth.current_user_is_attract_user():
raise wz_exceptions.Forbidden()
# Based on the project state, we can render a different template.
if not current_attract.is_attract_project(project):
return render_template('attract/project_settings/offer_setup.html',