@app.route('/<string:charity_id>/glc')
# @roles_accepted('admin',charity_id[:3])
def GLC(charity_id):
...
...
return render_template('one.html',charity_id=charity_id)
Is there a way of allowing a role, as defined by first 3 characters of the charity_id
i.e. charity_id[:3]
. At present, if the comment line is uncommented, charity_id is not defined and therefore doesn't work.
I am trying to allow someone with role 'admin' or 'charity_id[:3]' onto the page. Each user is assigned a role in flask security protocol. I am trying to test whether the persons allowed onto the page based on the page id i.e. string:charity_id
Many thanks