diff --git a/maintenance_user_ssh_key/.gitignore b/maintenance_user_ssh_key/.gitignore new file mode 100644 index 0000000..6da5887 --- /dev/null +++ b/maintenance_user_ssh_key/.gitignore @@ -0,0 +1,2 @@ +*.*~ +*pyc diff --git a/maintenance_user_ssh_key/README.md b/maintenance_user_ssh_key/README.md new file mode 100644 index 0000000..c27689b --- /dev/null +++ b/maintenance_user_ssh_key/README.md @@ -0,0 +1,63 @@ +============================== +maintenance_user_ssh_key +============================== + +This module adds SSH key management to Odoo users. It introduces a new +``ssh.key`` model and a ``ssh_key_ids`` One2many field on ``res.users``. + +It allows administrators to associate SSH public keys with each user for +authentication purposes (e.g., remote server access, deployment). + +Features: + +- **SSH Key model**: Store public keys per user. +- **User integration**: SSH keys are displayed and editable directly on the + user form view. +- **Access control**: All internal users can view SSH keys; only users with + ``Settings / Administration`` rights can create, edit, or delete them. + +# Installation + +Use Odoo normal module installation procedure to install +``maintenance_user_ssh_key``. + +This module depends on ``base`` and requires no external Python dependencies. + +# Configuration + +No specific configuration is required. After installation: + +1. Go to *Settings > Users & Companies > Users*. +2. Open any user and navigate to the **SSH Keys** notebook page. +3. Add SSH keys with the public key content. + +# Usage + +## Managing SSH Keys + +- Open a user form and go to the *SSH Keys* tab. +- Click **Add a line** and paste the public key content. + +# Bug Tracker + +Bugs are tracked on +`our issues website `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and +welcomed feedback. + +# Credits + +## Contributors + +- Stéphan Sainléger + +## Funders + +The development of this module has been financially supported by: + +- Elabore (https://elabore.coop) + +## Maintainer + +This module is maintained by Elabore. diff --git a/maintenance_user_ssh_key/__init__.py b/maintenance_user_ssh_key/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/maintenance_user_ssh_key/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/maintenance_user_ssh_key/__manifest__.py b/maintenance_user_ssh_key/__manifest__.py new file mode 100644 index 0000000..270b2d2 --- /dev/null +++ b/maintenance_user_ssh_key/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2026 Stéphan Sainléger (Elabore) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "maintenance_user_ssh_key", + "version": "18.0.1.0.0", + "author": "Elabore", + "website": "https://git.elabore.coop/elabore/maintenance-tools", + "maintainer": "Stéphan Sainléger", + "license": "AGPL-3", + "category": "Tools", + "summary": "Manage SSH keys per user.", + "depends": ["base"], + "data": [ + "security/ir.model.access.csv", + "views/ssh_key_views.xml", + "views/res_users_views.xml", + ], + "installable": True, + "auto_install": False, + "application": False, +} diff --git a/maintenance_user_ssh_key/models/__init__.py b/maintenance_user_ssh_key/models/__init__.py new file mode 100644 index 0000000..6129dc3 --- /dev/null +++ b/maintenance_user_ssh_key/models/__init__.py @@ -0,0 +1,2 @@ +from . import ssh_key +from . import res_users diff --git a/maintenance_user_ssh_key/models/res_users.py b/maintenance_user_ssh_key/models/res_users.py new file mode 100644 index 0000000..975e3de --- /dev/null +++ b/maintenance_user_ssh_key/models/res_users.py @@ -0,0 +1,14 @@ +# Copyright 2026 Stéphan Sainléger (Elabore) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + ssh_key_ids = fields.One2many( + comodel_name="ssh.key", + inverse_name="user_id", + string="SSH Keys", + ) diff --git a/maintenance_user_ssh_key/models/ssh_key.py b/maintenance_user_ssh_key/models/ssh_key.py new file mode 100644 index 0000000..c6cb24a --- /dev/null +++ b/maintenance_user_ssh_key/models/ssh_key.py @@ -0,0 +1,18 @@ +# Copyright 2026 Stéphan Sainléger (Elabore) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SshKey(models.Model): + _name = "ssh.key" + _description = "SSH Key" + + key = fields.Text(string="Public Key", required=True) + user_id = fields.Many2one( + comodel_name="res.users", + string="User", + required=True, + ondelete="cascade", + index=True, + ) diff --git a/maintenance_user_ssh_key/security/ir.model.access.csv b/maintenance_user_ssh_key/security/ir.model.access.csv new file mode 100644 index 0000000..26ed185 --- /dev/null +++ b/maintenance_user_ssh_key/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_ssh_key_user,ssh.key.user,model_ssh_key,base.group_user,1,0,0,0 +access_ssh_key_manager,ssh.key.manager,model_ssh_key,base.group_system,1,1,1,1 diff --git a/maintenance_user_ssh_key/views/res_users_views.xml b/maintenance_user_ssh_key/views/res_users_views.xml new file mode 100644 index 0000000..39e752e --- /dev/null +++ b/maintenance_user_ssh_key/views/res_users_views.xml @@ -0,0 +1,21 @@ + + + + + res.users.form.ssh.key + res.users + + + + + + + + + + + + + + + diff --git a/maintenance_user_ssh_key/views/ssh_key_views.xml b/maintenance_user_ssh_key/views/ssh_key_views.xml new file mode 100644 index 0000000..396fa7e --- /dev/null +++ b/maintenance_user_ssh_key/views/ssh_key_views.xml @@ -0,0 +1,44 @@ + + + + + ssh.key.tree + ssh.key + + + + + + + + + + ssh.key.form + ssh.key + +
+ + + + + + + + +
+
+
+ + + SSH Keys + ssh.key + list,form + + + + +