Skip to content

Commit cdd4f0d

Browse files
committed
[ADD] auth_partner, fastapi_auth_partner
1 parent b3788b2 commit cdd4f0d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3852
-0
lines changed

auth_partner/README.rst

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
============
2+
Partner Auth
3+
============
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:c9e735f01c49bc7974e3b9354b6157e19c7486a71626ad8eef81104b628d476b
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github
20+
:target: https://github.com/OCA/rest-framework/tree/16.0/auth_partner
21+
:alt: OCA/rest-framework
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-auth_partner
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module adds to the partners the ability to authenticate through directories.
32+
33+
This module does not implement any routing, it only provides the basic mechanisms in a directory for:
34+
35+
- Registering a partner and sending an welcome email (to validate email address): `_signup`
36+
- Authenticating a partner: `_login`
37+
- Validating a partner email using a token: `_validate_email`
38+
- Impersonating: `_impersonate`, `_impersonating`
39+
- Resetting the password with a unique token sent by mail: `_request_reset_password`, `_set_password`
40+
- Sending an invite mail when registering a partner from odoo interface for the partner to enter a password: `_send_invite`, `_set_password`
41+
42+
For a routing implementation, see the `fastapi_auth_partner <../fastapi_auth_partner>`_ module.
43+
44+
**Table of contents**
45+
46+
.. contents::
47+
:local:
48+
49+
Usage
50+
=====
51+
52+
This module isn't meant to be used standalone but you can still see the directories and authenticable partners in:
53+
54+
Settings > Technical > Partner Authentication > Partner
55+
56+
and
57+
58+
Settings > Technical > Partner Authentication > Directory
59+
60+
61+
Bug Tracker
62+
===========
63+
64+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rest-framework/issues>`_.
65+
In case of trouble, please check there if your issue has already been reported.
66+
If you spotted it first, help us to smash it by providing a detailed and welcomed
67+
`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**>`_.
68+
69+
Do not contact contributors directly about support or help with technical issues.
70+
71+
Credits
72+
=======
73+
74+
Authors
75+
~~~~~~~
76+
77+
* Akretion
78+
79+
Contributors
80+
~~~~~~~~~~~~
81+
82+
* `Akretion <https://www.akretion.com>`_:
83+
84+
* Sébastien Beau
85+
* Florian Mounier
86+
87+
Maintainers
88+
~~~~~~~~~~~
89+
90+
This module is maintained by the OCA.
91+
92+
.. image:: https://odoo-community.org/logo.png
93+
:alt: Odoo Community Association
94+
:target: https://odoo-community.org
95+
96+
OCA, or the Odoo Community Association, is a nonprofit organization whose
97+
mission is to support the collaborative development of Odoo features and
98+
promote its widespread use.
99+
100+
This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/16.0/auth_partner>`_ project on GitHub.
101+
102+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

auth_partner/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from . import wizards

auth_partner/__manifest__.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2024 Akretion (http://www.akretion.com).
2+
# @author Sébastien BEAU <[email protected]>
3+
# @author Florian Mounier <[email protected]>
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
5+
6+
{
7+
"name": "Partner Auth",
8+
"summary": "Implements the base features for a authenticable partner",
9+
"version": "16.0.1.0.0",
10+
"license": "AGPL-3",
11+
"author": "Akretion,Odoo Community Association (OCA)",
12+
"website": "https://github.com/OCA/rest-framework",
13+
"depends": [
14+
"auth_signup",
15+
"mail",
16+
"queue_job",
17+
],
18+
"data": [
19+
"security/res_group.xml",
20+
"security/ir.model.access.csv",
21+
"security/ir_rule.xml",
22+
"data/email_data.xml",
23+
"views/auth_partner_view.xml",
24+
"views/auth_directory_view.xml",
25+
"views/res_partner_view.xml",
26+
"wizards/wizard_auth_partner_reset_password_view.xml",
27+
],
28+
"demo": [
29+
"demo/res_partner_demo.xml",
30+
"demo/auth_directory_demo.xml",
31+
"demo/auth_partner_demo.xml",
32+
],
33+
"external_dependencies": {
34+
"python": ["itsdangerous", "pyjwt"],
35+
},
36+
}

auth_partner/data/email_data.xml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo noupdate="1">
3+
<record id="email_reset_password" model="mail.template">
4+
<field name="name">Auth Directory: Reset Password</field>
5+
<field name="email_from">[email protected]</field>
6+
<field name="subject">Reset Password</field>
7+
<field name="partner_to">{{object.partner_id.id}}</field>
8+
<field name="model_id" ref="model_auth_partner" />
9+
<field name="auto_delete" eval="True" />
10+
<field name="lang">${object.partner_id.lang}</field>
11+
<field name="body_html" type="html">
12+
<div>
13+
Hi <t t-out="object.partner_id.name or ''" />
14+
Click on the following link to reset your password
15+
<a
16+
t-attf-href="https://example.org/password/reset?token={{ object.env.context['token']}}"
17+
target="_blank"
18+
style="color:#FFFFFF; text-decoration:none;"
19+
>Reset Password</a>
20+
</div>
21+
</field>
22+
</record>
23+
24+
<record id="email_set_password" model="mail.template">
25+
<field name="name">Auth Directory: Set Password</field>
26+
<field name="email_from">[email protected]</field>
27+
<field name="subject">Welcome</field>
28+
<field name="partner_to">{{object.partner_id.id}}</field>
29+
<field name="model_id" ref="model_auth_partner" />
30+
<field name="auto_delete" eval="True" />
31+
<field name="lang">{{object.partner_id.lang}}</field>
32+
<field name="body_html" type="html">
33+
<div>
34+
Hi <t t-out="object.partner_id.name or ''" />
35+
Welcome, your account have been created
36+
Click on the following link to set your password
37+
<a
38+
t-attf-href="https://example.org/password/reset?token={{ object.env.context['token']}}"
39+
target="_blank"
40+
style="color:#FFFFFF; text-decoration:none;"
41+
>Set Password</a>
42+
</div>
43+
</field>
44+
</record>
45+
46+
<record id="email_validate_email" model="mail.template">
47+
<field name="name">Auth Directory: Validate Email</field>
48+
<field name="email_from">[email protected]</field>
49+
<field name="subject">Welcome</field>
50+
<field name="partner_to">{{object.partner_id.id}}</field>
51+
<field name="model_id" ref="model_auth_partner" />
52+
<field name="auto_delete" eval="True" />
53+
<field name="lang">{{object.partner_id.lang}}</field>
54+
<field name="body_html" type="html">
55+
<div>
56+
Hi <t t-out="object.partner_id.name or ''" />
57+
Welcome to the site, please click on the following link to verify your email
58+
<a
59+
t-attf-href="https://example.org/email/validate?token={{ object.env.context['token']}}"
60+
target="_blank"
61+
style="color:#FFFFFF; text-decoration:none;"
62+
>Validate Email</a>
63+
</div>
64+
</field>
65+
</record>
66+
67+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<record id="demo_directory" model="auth.directory">
4+
<field name="name">Demo Auth Directory</field>
5+
<field name="reset_password_template_id" ref="email_reset_password" />
6+
<field name="set_password_template_id" ref="email_set_password" />
7+
<field name="validate_email_template_id" ref="email_validate_email" />
8+
</record>
9+
</odoo>
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<record id="auth_partner_demo" model="auth.partner">
4+
<field name="partner_id" ref="res_partner_auth_demo" />
5+
<field name="directory_id" ref="demo_directory" />
6+
<field name="password">Super-secret$1</field>
7+
</record>
8+
</odoo>
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<record id="res_partner_auth_demo" model="res.partner">
4+
<field name="name">Demo auth partner</field>
5+
<field name="email">[email protected]</field>
6+
</record>
7+
</odoo>

auth_partner/models/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import auth_directory
2+
from . import auth_partner
3+
from . import res_partner

0 commit comments

Comments
 (0)