Skip to content

Commit

Permalink
[ADD] auth_partner, fastapi_auth_partner
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Oct 2, 2024
1 parent 4b9b18f commit d022300
Show file tree
Hide file tree
Showing 61 changed files with 3,851 additions and 0 deletions.
102 changes: 102 additions & 0 deletions auth_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
============
Partner Auth
============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c9e735f01c49bc7974e3b9354b6157e19c7486a71626ad8eef81104b628d476b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/16.0/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-16-0/rest-framework-16-0-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=16.0
:alt: Try me on Runboat

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

This module adds to the partners the ability to authenticate through directories.

This module does not implement any routing, it only provides the basic mechanisms in a directory for:

- Registering a partner and sending an welcome email (to validate email address): `_signup`
- Authenticating a partner: `_login`
- Validating a partner email using a token: `_validate_email`
- Impersonating: `_impersonate`, `_impersonating`
- Resetting the password with a unique token sent by mail: `_request_reset_password`, `_set_password`
- Sending an invite mail when registering a partner from odoo interface for the partner to enter a password: `_send_invite`, `_set_password`

For a routing implementation, see the `fastapi_auth_partner <../fastapi_auth_partner>`_ module.

**Table of contents**

.. contents::
:local:

Usage
=====

This module isn't meant to be used standalone but you can still see the directories and authenticable partners in:

Settings > Technical > Partner Authentication > Partner

and

Settings > Technical > Partner Authentication > Directory


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:%20auth_partner%0Aversion:%2016.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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions auth_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
36 changes: 36 additions & 0 deletions auth_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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": "Partner Auth",
"summary": "Implements the base features for a authenticable partner",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/rest-framework",
"depends": [
"auth_signup",
"mail",
"queue_job",
],
"data": [
"security/res_group.xml",
"security/ir.model.access.csv",
"security/ir_rule.xml",
"data/email_data.xml",
"views/auth_partner_view.xml",
"views/auth_directory_view.xml",
"views/res_partner_view.xml",
"wizards/wizard_auth_partner_reset_password_view.xml",
],
"demo": [
"demo/res_partner_demo.xml",
"demo/auth_directory_demo.xml",
"demo/auth_partner_demo.xml",
],
"external_dependencies": {
"python": ["itsdangerous", "pyjwt"],
},
}
67 changes: 67 additions & 0 deletions auth_partner/data/email_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<record id="email_reset_password" model="mail.template">
<field name="name">Auth Directory: Reset Password</field>
<field name="email_from">[email protected]</field>
<field name="subject">Reset Password</field>
<field name="partner_to">{{object.partner_id.id}}</field>
<field name="model_id" ref="model_auth_partner" />
<field name="auto_delete" eval="True" />
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html" type="html">
<div>
Hi <t t-out="object.partner_id.name or ''" />
Click on the following link to reset your password
<a
t-attf-href="https://example.org/password/reset?token={{ object.env.context['token']}}"
target="_blank"
style="color:#FFFFFF; text-decoration:none;"
>Reset Password</a>
</div>
</field>
</record>

<record id="email_set_password" model="mail.template">
<field name="name">Auth Directory: Set Password</field>
<field name="email_from">[email protected]</field>
<field name="subject">Welcome</field>
<field name="partner_to">{{object.partner_id.id}}</field>
<field name="model_id" ref="model_auth_partner" />
<field name="auto_delete" eval="True" />
<field name="lang">{{object.partner_id.lang}}</field>
<field name="body_html" type="html">
<div>
Hi <t t-out="object.partner_id.name or ''" />
Welcome, your account have been created
Click on the following link to set your password
<a
t-attf-href="https://example.org/password/reset?token={{ object.env.context['token']}}"
target="_blank"
style="color:#FFFFFF; text-decoration:none;"
>Set Password</a>
</div>
</field>
</record>

<record id="email_validate_email" model="mail.template">
<field name="name">Auth Directory: Validate Email</field>
<field name="email_from">[email protected]</field>
<field name="subject">Welcome</field>
<field name="partner_to">{{object.partner_id.id}}</field>
<field name="model_id" ref="model_auth_partner" />
<field name="auto_delete" eval="True" />
<field name="lang">{{object.partner_id.lang}}</field>
<field name="body_html" type="html">
<div>
Hi <t t-out="object.partner_id.name or ''" />
Welcome to the site, please click on the following link to verify your email
<a
t-attf-href="https://example.org/email/validate?token={{ object.env.context['token']}}"
target="_blank"
style="color:#FFFFFF; text-decoration:none;"
>Validate Email</a>
</div>
</field>
</record>

</odoo>
9 changes: 9 additions & 0 deletions auth_partner/demo/auth_directory_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="demo_directory" model="auth.directory">
<field name="name">Demo Auth Directory</field>
<field name="reset_password_template_id" ref="email_reset_password" />
<field name="set_password_template_id" ref="email_set_password" />
<field name="validate_email_template_id" ref="email_validate_email" />
</record>
</odoo>
8 changes: 8 additions & 0 deletions auth_partner/demo/auth_partner_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="auth_partner_demo" model="auth.partner">
<field name="partner_id" ref="res_partner_auth_demo" />
<field name="directory_id" ref="demo_directory" />
<field name="password">Super-secret$1</field>
</record>
</odoo>
7 changes: 7 additions & 0 deletions auth_partner/demo/res_partner_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="res_partner_auth_demo" model="res.partner">
<field name="name">Demo auth partner</field>
<field name="email">[email protected]</field>
</record>
</odoo>
3 changes: 3 additions & 0 deletions auth_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import auth_directory
from . import auth_partner
from . import res_partner
Loading

0 comments on commit d022300

Please sign in to comment.