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

feat: fix bug that functions cannot be found #69

Merged
merged 13 commits into from
Sep 8, 2023
Merged
4 changes: 1 addition & 3 deletions src/casdoor/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Adapter:
def __init__(self):
Expand All @@ -42,7 +40,7 @@ def to_dict(self) -> dict:
return self.__dict__


class AdapterSDK(CasdoorSDK):
class _AdapterSDK:
def get_adapters(self) -> List[Dict]:
"""
Get the adapters from Casdoor.
Expand Down
3 changes: 1 addition & 2 deletions src/casdoor/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import requests

from .main import CasdoorSDK
from .organization import Organization, ThemeData
from .provider import Provider

Expand Down Expand Up @@ -103,7 +102,7 @@ def to_dict(self) -> dict:
return self.__dict__


class ApplicationSDK(CasdoorSDK):
class _ApplicationSDK:
def get_applications(self) -> List[Dict]:
"""
Get the applications from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

import requests

from .main import CasdoorSDK


class Cert:
def __init__(self):
Expand All @@ -43,7 +41,7 @@ def to_dict(self) -> dict:
return self.__dict__


class CertSDK(CasdoorSDK):
class _CertSDK:
def get_certs(self) -> List[Dict]:
"""
Get the certs from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/enforcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Enforcer:
def __init__(self):
Expand All @@ -38,7 +36,7 @@ def to_dict(self) -> dict:
return self.__dict__


class EnforcerSDK(CasdoorSDK):
class _EnforcerSDK:
def get_enforcers(self) -> List[Dict]:
"""
Get the enforcers from Casdoor.
Expand Down
3 changes: 1 addition & 2 deletions src/casdoor/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import requests

from .main import CasdoorSDK
from .user import User


Expand Down Expand Up @@ -45,7 +44,7 @@ def to_dict(self) -> dict:
return self.__dict__


class GroupSDK(CasdoorSDK):
class _GroupSDK:
def get_groups(self) -> List[Dict]:
"""
Get the groups from Casdoor.
Expand Down
49 changes: 46 additions & 3 deletions src/casdoor/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,59 @@
# 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.

from typing import Dict, List, Optional

import jwt
import requests
from cryptography import x509
from cryptography.hazmat.backends import default_backend


class CasdoorSDK:
from .adapter import _AdapterSDK
from .application import _ApplicationSDK
from .cert import _CertSDK
from .enforcer import _EnforcerSDK
from .group import _GroupSDK
from .model import _ModelSDK
from .organization import _OrganizationSDK
from .payment import _PaymentSDK
from .permisssion import _PermissionSDK
from .plan import _PlanSDK
from .pricing import _PricingSDK
from .product import _ProductSDK
from .provider import _ProviderSDK
from .resource import _ResourceSDK
from .role import _RoleSDK
from .session import _SessionSDK
from .subscription import _SubscriptionSDK
from .syncer import _SyncerSDK
from .token import _TokenSDK
from .user import _UserSDK
from .webhook import _WebhookSDK


class CasdoorSDK(
_UserSDK,
_AdapterSDK,
_OrganizationSDK,
_ApplicationSDK,
_CertSDK,
_ResourceSDK,
_RoleSDK,
_SessionSDK,
_SyncerSDK,
_EnforcerSDK,
_GroupSDK,
_ModelSDK,
_PaymentSDK,
_PermissionSDK,
_PlanSDK,
_PricingSDK,
_ProviderSDK,
_ProductSDK,
_SubscriptionSDK,
_TokenSDK,
_WebhookSDK,
):
def __init__(
self,
endpoint: str,
Expand Down
3 changes: 1 addition & 2 deletions src/casdoor/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import requests

from .main import CasdoorSDK
from .user import User


Expand Down Expand Up @@ -45,7 +44,7 @@ def to_dict(self) -> dict:
return self.__dict__


class ModelSDK(CasdoorSDK):
class _ModelSDK:
def get_models(self) -> List[Dict]:
"""
Get the models from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class AccountItem:
def __init__(self):
Expand Down Expand Up @@ -91,7 +89,7 @@ def to_dict(self) -> dict:
return self.__dict__


class OrganizationSDK(CasdoorSDK):
class _OrganizationSDK:
def get_organizations(self) -> List[Dict]:
"""
Get the organizations from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Payment:
def __init__(self):
Expand Down Expand Up @@ -56,7 +54,7 @@ def to_dict(self) -> dict:
return self.__dict__


class PaymentSDK(CasdoorSDK):
class _PaymentSDK:
def get_payments(self) -> List[Dict]:
"""
Get the payments from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/permisssion.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Permission:
def __init__(self):
Expand Down Expand Up @@ -48,7 +46,7 @@ def to_dict(self) -> dict:
return self.__dict__


class PermissionSDK(CasdoorSDK):
class _PermissionSDK:
def get_permissions(self) -> List[Dict]:
"""
Get the permissions from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Plan:
def __init__(self):
Expand All @@ -40,7 +38,7 @@ def to_dict(self) -> dict:
return self.__dict__


class PlanSDK(CasdoorSDK):
class _PlanSDK:
def get_plans(self) -> List[Dict]:
"""
Get the plans from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/pricing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Pricing:
def __init__(self):
Expand All @@ -42,7 +40,7 @@ def to_dict(self) -> dict:
return self.__dict__


class PricingSDK(CasdoorSDK):
class _PricingSDK:
def get_pricings(self) -> List[Dict]:
"""
Get the pricings from Casdoor.
Expand Down
3 changes: 1 addition & 2 deletions src/casdoor/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import requests

from .main import CasdoorSDK
from .provider import Provider


Expand Down Expand Up @@ -46,7 +45,7 @@ def to_dict(self) -> dict:
return self.__dict__


class ProductSDK(CasdoorSDK):
class _ProductSDK:
def get_products(self) -> List[Dict]:
"""
Get the products from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Provider:
def __init__(self):
Expand Down Expand Up @@ -68,7 +66,7 @@ def to_dict(self) -> dict:
return self.__dict__


class ProviderSDK(CasdoorSDK):
class _ProviderSDK:
def get_providers(self) -> List[Dict]:
"""
Get the providers from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Resource:
def __init__(self):
Expand All @@ -43,7 +41,7 @@ def to_dict(self) -> dict:
return self.__dict__


class ResourceSDK(CasdoorSDK):
class _ResourceSDK:
def get_resources(self, owner, user, field, value, sort_field, sort_order) -> List[Dict]:
"""
Get the resources from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Role:
def __init__(self):
Expand All @@ -38,7 +36,7 @@ def to_dict(self) -> dict:
return self.__dict__


class RoleSDK(CasdoorSDK):
class _RoleSDK:
def get_roles(self) -> List[Dict]:
"""
Get the roles from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class Session:
def __init__(self):
Expand All @@ -34,7 +32,7 @@ def to_dict(self) -> dict:
return self.__dict__


class SessionSDK(CasdoorSDK):
class _SessionSDK:
def get_sessions(self) -> List[Dict]:
"""
Get the sessions from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

import requests

from .main import CasdoorSDK


class Subscription:
def __init__(self):
Expand All @@ -45,7 +43,7 @@ def to_dict(self) -> dict:
return self.__dict__


class SubscriptionSDK(CasdoorSDK):
class _SubscriptionSDK:
def get_subscriptions(self) -> List[Dict]:
"""
Get the subscriptions from Casdoor.
Expand Down
4 changes: 1 addition & 3 deletions src/casdoor/syncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import requests

from .main import CasdoorSDK


class TableColumn:
def __init__(self):
Expand Down Expand Up @@ -65,7 +63,7 @@ def to_dict(self) -> dict:
return self.__dict__


class SyncerSDK(CasdoorSDK):
class _SyncerSDK:
def get_syncers(self) -> List[Dict]:
"""
Get the syncers from Casdoor.
Expand Down
Loading
Loading