Refactor integrations of sso
This commit is contained in:
parent
ce5a7d05ac
commit
f377b4ce45
46 changed files with 154 additions and 249 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from .kratos_api import *
|
||||
from .error_handler import *
|
||||
from .hydra_oauth import *
|
||||
from .kratos import *
|
||||
from .models import *
|
||||
from .kratos_user import *
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
"""
|
||||
Implement different models used by Stackspin panel
|
||||
"""
|
||||
|
||||
|
||||
from flask import current_app
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
# pylint: disable=cyclic-import
|
||||
# This is based on the documentation of Flask Alchemy
|
||||
#from app import db
|
||||
|
||||
# We need this import at some point to hook up roles and users
|
||||
# from sqlalchemy.orm import relationship
|
||||
from sqlalchemy import ForeignKey, Integer, String
|
||||
|
||||
from database import db
|
||||
|
||||
# Pylint complains about too-few-public-methods. Methods will be added once
|
||||
# this is implemented.
|
||||
# pylint: disable=too-few-public-methods
|
||||
class App(db.Model):
|
||||
"""
|
||||
The App object, interact with the App database object. Data is stored in
|
||||
the local database.
|
||||
"""
|
||||
|
||||
|
||||
id = db.Column(Integer, primary_key=True)
|
||||
name = db.Column(String(length=64))
|
||||
slug = db.Column(String(length=64), unique=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.id} <{self.name}>"
|
||||
|
||||
# Pylint complains about too-few-public-methods. Methods will be added once
|
||||
# this is implemented.
|
||||
# pylint: disable=too-few-public-methods
|
||||
class AppRole(db.Model):
|
||||
"""
|
||||
The AppRole object, stores the roles Users have on Apps
|
||||
"""
|
||||
|
||||
# pylint: disable=no-member
|
||||
user_id = db.Column(String(length=64), primary_key=True)
|
||||
# pylint: disable=no-member
|
||||
app_id = db.Column(Integer, ForeignKey('app.id'),
|
||||
primary_key=True)
|
||||
|
||||
# pylint: disable=no-member
|
||||
role = db.Column(String(length=64))
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.role} for {self.user_id} on {self.app_id}"
|
||||
Reference in a new issue