Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: security api #1831

Merged
merged 15 commits into from
Apr 28, 2022
Merged
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7]
python-version: [3.8]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions examples/crud_rest_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

basedir = os.path.abspath(os.path.dirname(__file__))

FAB_ADD_SECURITY_API = True
CSRF_ENABLED = True
SECRET_KEY = "\2\1thisismyscretkey\1\2\e\y\y\h"

Expand Down
10 changes: 6 additions & 4 deletions flask_appbuilder/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .convert import Model2SchemaConverter
from .schemas import get_info_schema, get_item_schema, get_list_schema
from .._compat import as_unicode
from ..baseviews import AbstractViewApi
from ..const import (
API_ADD_COLUMNS_RES_KEY,
API_ADD_COLUMNS_RIS_KEY,
Expand Down Expand Up @@ -203,7 +204,7 @@ def wrap(f):
return wrap


class BaseApi(object):
class BaseApi(AbstractViewApi):
"""
All apis inherit from this class.
it's constructor will register your exposed urls on flask
Expand All @@ -213,8 +214,6 @@ class BaseApi(object):
but provides a common base for all APIS.
"""

appbuilder = None
blueprint = None
endpoint: Optional[str] = None

version: Optional[str] = "v1"
Expand Down Expand Up @@ -436,6 +435,9 @@ def __init__(self) -> None:

Initialization of extra args
"""
self.appbuilder = None
self.blueprint = None

# Init OpenAPI
self._response_key_func_mappings = dict()
self.apispec_parameter_schemas = self.apispec_parameter_schemas or dict()
Expand Down Expand Up @@ -652,7 +654,7 @@ def get_uninit_inner_views(self):
"""
return []

def get_init_inner_views(self, views):
def get_init_inner_views(self):
"""
Sets initialized inner views
"""
Expand Down
Loading