Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions base_rest/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========
Base Rest
=========
Expand All @@ -17,7 +13,7 @@ Base Rest
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github
Expand Down
5 changes: 2 additions & 3 deletions base_rest/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": "18.0.1.1.2",
"development_status": "Beta",
"license": "LGPL-3",
"author": "ACSONE SA/NV, " "Odoo Community Association (OCA)",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"maintainers": [],
"website": "https://github.com/OCA/rest-framework",
"depends": ["component", "web"],
Expand All @@ -20,8 +20,7 @@
"assets": {
"web.assets_frontend": [
"base_rest/static/src/scss/base_rest.scss",
"base_rest/static/src/js/swagger_ui.js",
"base_rest/static/src/js/swagger.js",
"base_rest/static/src/js/components/swagger_ui.js",
],
},
"external_dependencies": {
Expand Down
42 changes: 18 additions & 24 deletions base_rest/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Base Rest</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="base-rest">
<h1 class="title">Base Rest</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="base-rest">
<h1>Base Rest</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4bac77b10863d37a6d94d450ac1584accce5be4a436a7a839f8035d8cab1729d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/license-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rest-framework/tree/18.0/base_rest"><img alt="OCA/rest-framework" src="https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-base_rest"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rest-framework/tree/18.0/base_rest"><img alt="OCA/rest-framework" src="https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-base_rest"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This addon is deprecated and not fully supported anymore from Odoo 16.
Please migrate to the FastAPI migration module. See
<a class="reference external" href="https://github.com/OCA/rest-framework/pull/291">https://github.com/OCA/rest-framework/pull/291</a>.</p>
Expand Down Expand Up @@ -414,7 +409,7 @@ <h1>Base Rest</h1>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>If an error occurs when calling a method of a service (ie missing
parameter, ..) the system returns only a general description of the
problem without details. This is done on purpose to ensure maximum
Expand All @@ -436,7 +431,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
mode in production</strong>.</p>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To add your own REST service you must provides at least 2 classes.</p>
<ul class="simple">
<li>A Component providing the business logic of your service,</li>
Expand Down Expand Up @@ -683,17 +678,17 @@ <h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
evaluation context.</p>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<p>The
<a class="reference external" href="https://github.com/OCA/rest-framework/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement+label%3Abase_rest">roadmap</a>
and <a class="reference external" href="https://github.com/OCA/rest-framework/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Abase_rest">known
issues</a>
can be found on GitHub.</p>
</div>
<div class="section" id="changelog">
<h2><a class="toc-backref" href="#toc-entry-4">Changelog</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Changelog</a></h1>
<div class="section" id="section-1">
<h3><a class="toc-backref" href="#toc-entry-5">16.0.1.0.2 (2023-10-07)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">16.0.1.0.2 (2023-10-07)</a></h2>
<p><strong>Features</strong></p>
<ul class="simple">
<li>Add support for oauth2 security scheme in the Swagger UI. If your
Expand All @@ -707,59 +702,59 @@ <h3><a class="toc-backref" href="#toc-entry-5">16.0.1.0.2 (2023-10-07)</a></h3>
</ul>
</div>
<div class="section" id="section-2">
<h3><a class="toc-backref" href="#toc-entry-6">12.0.2.0.1</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">12.0.2.0.1</a></h2>
<ul class="simple">
<li>validator_…() methods can now return a cerberus <tt class="docutils literal">Validator</tt>
object instead of a schema dictionnary, for additional flexibility
(e.g. allowing validator options such as <tt class="docutils literal">allow_unknown</tt>).</li>
</ul>
</div>
<div class="section" id="section-3">
<h3><a class="toc-backref" href="#toc-entry-7">12.0.2.0.0</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">12.0.2.0.0</a></h2>
<ul class="simple">
<li>Licence changed from AGPL-3 to LGPL-3</li>
</ul>
</div>
<div class="section" id="section-4">
<h3><a class="toc-backref" href="#toc-entry-8">12.0.1.0.1</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">12.0.1.0.1</a></h2>
<ul class="simple">
<li>Fix issue when rendering the jsonapi documentation if no documentation
is provided on a method part of the REST api.</li>
</ul>
</div>
<div class="section" id="section-5">
<h3><a class="toc-backref" href="#toc-entry-9">12.0.1.0.0</a></h3>
<h2><a class="toc-backref" href="#toc-entry-9">12.0.1.0.0</a></h2>
<p>First official version. The addon has been incubated into the
<a class="reference external" href="https://github.com/akretion/odoo-shopinvader">Shopinvader
repository</a> from
Akretion. For more information you need to look at the git log.</p>
</div>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-10">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-10">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/rest-framework/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/rest-framework/issues/new?body=module:%20base_rest%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-11">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-11">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-12">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-12">Authors</a></h2>
<ul class="simple">
<li>ACSONE SA/NV</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-13">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-13">Contributors</a></h2>
<ul class="simple">
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
<li>Sébastien Beau &lt;<a class="reference external" href="mailto:sebastien.beau&#64;akretion.com">sebastien.beau&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-14">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-14">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -772,6 +767,5 @@ <h3><a class="toc-backref" href="#toc-entry-14">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
148 changes: 148 additions & 0 deletions fastapi_auth_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
====================
Fastapi Auth Partner
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2ebd9377ca7b035ab9fb0383513aacb5ca8645f69d5d85c171883b40b439017e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github
:target: https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_partner
:alt: OCA/rest-framework
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-fastapi_auth_partner
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module is the FastAPI implementation of
`auth_partner <../auth_partner>`__ it provides all the routes to manage
the authentication of partners.

**Table of contents**

.. contents::
:local:

Usage
=====

First you have to add the auth router to your FastAPI endpoint and the
authentication dependency to your app dependencies:

.. code:: python

from odoo.addons.fastapi import dependencies
from odoo.addons.fastapi_auth_partner.dependencies import (
auth_partner_authenticated_partner,
)
from odoo.addons.fastapi_auth_partner.routers.auth import auth_router

class FastapiEndpoint(models.Model):
_inherit = "fastapi.endpoint"

def _get_fastapi_routers(self):
if self.app == "myapp":
return [
auth_router,
]
return super()._get_fastapi_routers()

def _get_app_dependencies_overrides(self):
res = super()._get_app_dependencies_overrides()
if self.app == "myapp":
res.update(
{
dependencies.authenticated_partner_impl: auth_partner_authenticated_partner,
}
)
return res

Next you can manage your authenticable partners and directories in the
Odoo interface:

FastAPI > Authentication > Partner

and

FastAPI > Authentication > Directory

Next you must set the directory used for the authentication in the
FastAPI endpoint:

FastAPI > FastAPI Endpoint > myapp > Directory

Then you can use the auth router to authenticate your requests:

- POST /auth/register to register a partner
- POST /auth/login to authenticate a partner
- POST /auth/logout to unauthenticate a partner
- POST /auth/validate_email to validate a partner email
- POST /auth/request_reset_password to request a password reset
- POST /auth/set_password to set a new password
- GET /auth/profile to get the partner profile
- GET /auth/impersonate to impersonate a partner

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/rest-framework/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/rest-framework/issues/new?body=module:%20fastapi_auth_partner%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Akretion

Contributors
------------

- `Akretion <https://www.akretion.com>`__:

- Sébastien Beau
- Florian Mounier

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-paradoxxxzero| image:: https://github.com/paradoxxxzero.png?size=40px
:target: https://github.com/paradoxxxzero
:alt: paradoxxxzero

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-paradoxxxzero|

This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/18.0/fastapi_auth_partner>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions fastapi_auth_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import models
from . import routers
from . import schemas
from . import wizards
34 changes: 34 additions & 0 deletions fastapi_auth_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2024 Akretion (http://www.akretion.com).
# @author Sébastien BEAU <[email protected]>
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Fastapi Auth Partner",
"summary": """This provides an implementation of auth_partner for FastAPI""",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/rest-framework",
"depends": [
"extendable_fastapi",
"auth_partner",
],
"data": [
"security/res_group.xml",
"security/ir_rule.xml",
"security/ir.model.access.csv",
"views/auth_partner_view.xml",
"views/auth_directory_view.xml",
"views/fastapi_endpoint_view.xml",
"wizards/wizard_auth_partner_impersonate_view.xml",
"wizards/wizard_auth_partner_reset_password_view.xml",
],
"demo": [
"demo/fastapi_endpoint_demo.xml",
],
"maintainers": ["paradoxxxzero"],
"external_dependencies": {
"python": ["itsdangerous"],
},
}
Loading
Loading