feature.py 729 B

1234567891011121314151617181920212223242526272829
  1. from flask_login import current_user
  2. from flask_restful import Resource
  3. from libs.login import login_required
  4. from services.feature_service import FeatureService
  5. from . import api
  6. from .setup import setup_required
  7. from .wraps import account_initialization_required, cloud_utm_record
  8. class FeatureApi(Resource):
  9. @setup_required
  10. @login_required
  11. @account_initialization_required
  12. @cloud_utm_record
  13. def get(self):
  14. return FeatureService.get_features(current_user.current_tenant_id).dict()
  15. class SystemFeatureApi(Resource):
  16. def get(self):
  17. return FeatureService.get_system_features().dict()
  18. api.add_resource(FeatureApi, '/features')
  19. api.add_resource(SystemFeatureApi, '/system-features')