Ejemplo n.º 1
0
                           user=session.get('user'),
                           recipe_id=request.args.get('recipe'))


app.add_url_rule('/', view_func=LandingPageController.as_view('landing_page'))

app.add_url_rule('/new_recipe',
                 view_func=NewRecipeController.as_view('new_recipe'))

app.add_url_rule('/dashboard',
                 view_func=DashboardController.as_view('dashboard'))

app.add_url_rule('/returning/', view_func=LoginController.as_view('returning'))

app.add_url_rule('/users/',
                 view_func=UsersController.as_view('user-registration'))

recipes_url = RecipesController.as_view('recipes')
instructions_url = InstructionsController.as_view('instructions')

app.add_url_rule('/recipes/',
                 defaults={'recipe_id': None},
                 view_func=recipes_url,
                 methods=[
                     'GET',
                 ])
app.add_url_rule('/recipes/', view_func=recipes_url, methods=[
    'POST',
])
app.add_url_rule('/recipes/<int:recipe_id>',
                 view_func=recipes_url,
Ejemplo n.º 2
0
        if isinstance(lookup, dict):
            # get next lookup level
            lookup = lookup.get(part)
        else:
            # lookup level too deep
            lookup = None
        if lookup is None:
            # return input value if not found
            lookup = value
            break

    return lookup


# create controllers (including their routes)
UsersController(app, config_models)
GroupsController(app, config_models)
RolesController(app, config_models)
ResourcesController(app, config_models)
PermissionsController(app, config_models)
if app.config.get('QWC_GROUP_REGISTRATION_ENABLED'):
    RegistrableGroupsController(app, config_models)
    RegistrationRequestsController(app, config_models, i18n, mail)

acccess_control = AccessControl(config_models, app.logger)


@app.before_request
@jwt_optional
def assert_admin_role():
    identity = get_jwt_identity()
Ejemplo n.º 3
0
            TenantConfigHandler(tenant, db_engine, app.logger))
    return handler


app.wsgi_app = TenantPrefixMiddleware(app.wsgi_app)
app.session_interface = TenantSessionInterface(os.environ)


def auth_path_prefix():
    # e.g. /admin/org1/auth
    return app.session_interface.tenant_path_prefix().rstrip(
        "/") + "/" + AUTH_PATH.lstrip("/")


# create controllers (including their routes)
UsersController(app, handler)
GroupsController(app, handler)
RolesController(app, handler)
ResourcesController(app, handler)
PermissionsController(app, handler)
if app.config.get('QWC_GROUP_REGISTRATION_ENABLED'):
    RegistrableGroupsController(app, handler)
    RegistrationRequestsController(app, handler, i18n, mail)

access_control = AccessControl(handler, app.logger)

plugins_loaded = False


@app.before_first_request
def load_plugins():
Ejemplo n.º 4
0
# loading the KB
loader = N3KBLoader(settings)
for filename in settings["kb_files"]:
    loader.load_n3file(filename)

# creating an instance of Flask
# and one of the authenticator
app = Flask(__name__)
auth = HTTPBasicAuth()

# creating an instance of each controller
reservations_controller = ReservationsController(settings)
gss_controller = GroundStationsController(settings)
vehicles_controller = VehiclesController(settings)
users_controller = UsersController(settings)
auth_controller = AuthController(settings)
trad_controller = TradController(settings)

################################################
#
# login methods
#
################################################


@auth.get_password
def get_password(username):
    """This is a callback used by the server to retrieve
    the password for a given username"""