Skip to content

Commit

Permalink
Move user and roles schemas to fab provider (apache#42869)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincbeck authored and harjeevanmaan committed Oct 23, 2024
1 parent d004675 commit 5e58d66
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

from airflow.api_connexion.exceptions import AlreadyExists, BadRequest, NotFound
from airflow.api_connexion.parameters import check_limit, format_parameters
from airflow.api_connexion.schemas.role_and_permission_schema import (
from airflow.api_connexion.security import requires_access_custom_view
from airflow.providers.fab.auth_manager.models import Action, Role
from airflow.providers.fab.auth_manager.schemas.role_and_permission_schema import (
ActionCollection,
RoleCollection,
action_collection_schema,
role_collection_schema,
role_schema,
)
from airflow.api_connexion.security import requires_access_custom_view
from airflow.providers.fab.auth_manager.models import Action, Role
from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
from airflow.security import permissions
from airflow.www.extensions.init_auth_manager import get_auth_manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@

from airflow.api_connexion.exceptions import AlreadyExists, BadRequest, NotFound, Unknown
from airflow.api_connexion.parameters import check_limit, format_parameters
from airflow.api_connexion.schemas.user_schema import (
from airflow.api_connexion.security import requires_access_custom_view
from airflow.providers.fab.auth_manager.models import User
from airflow.providers.fab.auth_manager.schemas.user_schema import (
UserCollection,
user_collection_item_schema,
user_collection_schema,
user_schema,
)
from airflow.api_connexion.security import requires_access_custom_view
from airflow.providers.fab.auth_manager.models import User
from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
from airflow.security import permissions
from airflow.www.extensions.init_auth_manager import get_auth_manager
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from marshmallow_sqlalchemy import SQLAlchemySchema, auto_field

from airflow.api_connexion.parameters import validate_istimezone
from airflow.api_connexion.schemas.role_and_permission_schema import RoleSchema
from airflow.providers.fab.auth_manager.models import User
from airflow.providers.fab.auth_manager.schemas.role_and_permission_schema import RoleSchema


class UserCollectionItemSchema(SQLAlchemySchema):
Expand Down
17 changes: 17 additions & 0 deletions providers/tests/fab/auth_manager/schemas/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# 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.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import pytest

from airflow.api_connexion.schemas.role_and_permission_schema import (
from airflow.providers.fab.auth_manager.schemas.role_and_permission_schema import (
RoleCollection,
role_collection_schema,
role_schema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
from providers.tests.fab.auth_manager.api_endpoints.api_connexion_utils import create_role, delete_role

with ignore_provider_compatibility_error("2.9.0+", __file__):
from airflow.api_connexion.schemas.user_schema import user_collection_item_schema, user_schema
from airflow.providers.fab.auth_manager.models import User
from airflow.providers.fab.auth_manager.schemas.user_schema import (
user_collection_item_schema,
user_schema,
)


TEST_EMAIL = "test@example.org"
Expand Down

0 comments on commit 5e58d66

Please sign in to comment.