Skip to content

Commit

Permalink
Ensure role exists before allow it
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgalvez-tiendeo committed Jan 19, 2021
1 parent 8271dd4 commit e825810
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flask_rbac/__init__.py
Expand Up @@ -420,11 +420,12 @@ def _deny_hook(self):

def _setup_acl(self):
for rn, method, resource, with_children in self.before_acl['allow']:
role = self._role_model.get_by_name(rn)
if rn == 'anonymous':
role = anonymous
else:
role = self._role_model.get_by_name(rn)
if not role:
continue
self.acl.allow(role, method, resource, with_children)

if not self.use_white:
Expand Down

0 comments on commit e825810

Please sign in to comment.