Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hokanosekai committed Feb 7, 2024
1 parent a33a532 commit 01d079d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion flask_rbac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def init_app(self, app):

app.before_request(self._authenticate)

def _check_setup_finished(self, f_name: str) -> None:
pass

def as_role_model(self, model_cls):
"""A decorator to set custom model or role.
Expand Down Expand Up @@ -247,7 +250,6 @@ def a_view_func():
:param endpoint: The application endpoint.
:param user: user who you need to check. Current user by default.
"""
app = self.get_app()
_user = user or self._user_loader()
if not hasattr(_user, 'get_roles'):
roles = [anonymous]
Expand Down Expand Up @@ -282,6 +284,7 @@ def decorator(view_func):
resource = [endpoint or view_func.__name__]
for r, m, v in itertools.product(roles, _methods, resource):
self.before_acl['allow'].append((r, m, v, with_children))

return view_func
return decorator

Expand All @@ -308,6 +311,7 @@ def decorator(view_func):
resource = [endpoint or view_func.__name__]
for r, m, v in itertools.product(roles, _methods, resource):
self.before_acl['deny'].append((r, m, v, with_children))

return view_func
return decorator

Expand Down

0 comments on commit 01d079d

Please sign in to comment.