Skip to content

Commit

Permalink
fix(packages): Fixing users packages (#18973)
Browse files Browse the repository at this point in the history
* Fixing users packages

* Linting me() fn

* Fixing tests / moving packages

* Fixing imports

(cherry picked from commit 5fc7adb)
  • Loading branch information
craig-rueda authored and villebro committed Apr 3, 2022
1 parent e8cf944 commit 3c90220
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion superset/initialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
)
from superset.security import SupersetSecurityManager
from superset.typing import FlaskResponse
from superset.users.api import CurrentUserRestApi
from superset.utils.core import pessimistic_connection_handling
from superset.utils.log import DBEventLogger, get_event_logger_from_cfg_value

Expand Down Expand Up @@ -195,6 +194,7 @@ def init_views(self) -> None:
TabStateView,
)
from superset.views.tags import TagView
from superset.views.users.api import CurrentUserRestApi

#
# Setup API views
Expand Down
17 changes: 17 additions & 0 deletions superset/views/users/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
2 changes: 1 addition & 1 deletion superset/users/api.py → superset/views/users/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CurrentUserRestApi(BaseApi):

@expose("/", methods=["GET"])
@safe
def me(self) -> Response:
def get_me(self) -> Response:
"""Get the user object corresponding to the agent making the request
---
get:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/integration_tests/security_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def test_views_are_secured(self):
["LocaleView", "index"],
["AuthDBView", "login"],
["AuthDBView", "logout"],
["CurrentUserRestApi", "me"],
["CurrentUserRestApi", "get_me"],
["Dashboard", "embedded"],
["R", "index"],
["Superset", "log"],
Expand Down
17 changes: 17 additions & 0 deletions tests/integration_tests/users/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

0 comments on commit 3c90220

Please sign in to comment.