flask-rbac
flask-rbac copied to clipboard
Unable to use Flask-FontAwesome: the css and js are 403 blocked
Note, I have app.config['RBAC_USE_WHITE'] = True in my app.
This issue probably applies to other packages that initialise the css/js from the app and include it in the html headers like
<head>
...
{{ fontawesome_html() }}
...
</head>
The solution in my case is to exempt the endpoint "fontawesome.static". Decided to work-around thusly in order to populate the _exempt list for each instance:
MRBAC.py
from flask_rbac import RBAC
class MRBAC(RBAC):
ADDITIONAL_EXEMPTIONS = [
"fontawesome.static"
]
def __init__(self):
super().__init__()
self.do_additional_exemptions()
def do_additional_exemptions(self):
for e in self.ADDITIONAL_EXEMPTIONS:
self.acl.exempt(e)
rbac = MRBAC()
and in the application's init.py:
from app.MRBAC import MRBAC
rbac = MRBAC()