Hide Attract links & project settings for non-attract-users
This commit is contained in:
@@ -170,9 +170,16 @@ class AttractExtension(PillarExtension):
|
|||||||
if not self.is_attract_project(project):
|
if not self.is_attract_project(project):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
if not self.auth.current_user_may(auth.Actions.VIEW):
|
||||||
|
return ''
|
||||||
|
|
||||||
return flask.render_template('attract/sidebar.html',
|
return flask.render_template('attract/sidebar.html',
|
||||||
project=project)
|
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:
|
def project_settings(self, project: pillarsdk.Project, **template_args: dict) -> flask.Response:
|
||||||
"""Renders the project settings page for this extension.
|
"""Renders the project settings page for this extension.
|
||||||
|
|
||||||
|
@@ -171,6 +171,9 @@ def project_settings(project: pillarsdk.Project, **template_args: dict):
|
|||||||
|
|
||||||
from . import EXTENSION_NAME
|
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.
|
# Based on the project state, we can render a different template.
|
||||||
if not current_attract.is_attract_project(project):
|
if not current_attract.is_attract_project(project):
|
||||||
return render_template('attract/project_settings/offer_setup.html',
|
return render_template('attract/project_settings/offer_setup.html',
|
||||||
|
Reference in New Issue
Block a user