diff --git a/base_group_internal/README.rst b/base_group_internal/README.rst new file mode 100644 index 000000000..1e3921602 --- /dev/null +++ b/base_group_internal/README.rst @@ -0,0 +1,62 @@ +=================== +Base Group Internal +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9576c06acfaed505c902eb59d321c3c94e878d75561661d1057e69b6d7d94057 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-NuoBiT%2Fodoo--addons-lightgray.png?logo=github + :target: https://github.com/NuoBiT/odoo-addons/tree/17.0/base_group_internal + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + +This module extends base to include security features. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* NuoBiT Solutions SL + +Contributors +------------ + +- `NuoBiT `__: + + - Kilian Niubo + +Maintainers +----------- + +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/base_group_internal/__init__.py b/base_group_internal/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/base_group_internal/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/base_group_internal/__manifest__.py b/base_group_internal/__manifest__.py new file mode 100644 index 000000000..3d046074f --- /dev/null +++ b/base_group_internal/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +{ + "name": "Base Group Internal", + "summary": "This module extends base to include security features.", + "version": "17.0.1.0.0", + "category": "Hidden", + "author": "NuoBiT Solutions SL", + "website": "https://github.com/NuoBiT/odoo-addons", + "license": "AGPL-3", + "depends": ["web"], + "data": [ + "views/res_groups_views.xml", + ], +} diff --git a/base_group_internal/models/__init__.py b/base_group_internal/models/__init__.py new file mode 100644 index 000000000..127ecba59 --- /dev/null +++ b/base_group_internal/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_groups +from . import res_users diff --git a/base_group_internal/models/res_groups.py b/base_group_internal/models/res_groups.py new file mode 100644 index 000000000..6d5503000 --- /dev/null +++ b/base_group_internal/models/res_groups.py @@ -0,0 +1,14 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import fields, models + + +class ResGroups(models.Model): + _inherit = "res.groups" + + is_internal = fields.Boolean( + string="Internal Group", + help="Check this box if the group is an internal group.", + ) diff --git a/base_group_internal/models/res_users.py b/base_group_internal/models/res_users.py new file mode 100644 index 000000000..82233c0b4 --- /dev/null +++ b/base_group_internal/models/res_users.py @@ -0,0 +1,32 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import logging + +from odoo import api, models + +_logger = logging.getLogger(__name__) + + +class Users(models.Model): + _inherit = "res.users" + + @api.depends("groups_id") + def _compute_share(self): + res = super()._compute_share() + internal_users = self.filtered_domain([("groups_id.is_internal", "=", True)]) + internal_users.share = False + return res + + @api.model + def has_group(self, group_ext_id): + has_group = super().has_group(group_ext_id) + if group_ext_id == "base.group_user": + has_group |= bool(self.groups_id.filtered(lambda x: x.is_internal)) + return has_group + + def _is_internal(self): + res = super()._is_internal() + if self.sudo().groups_id.filtered(lambda x: x.is_internal): + res = True + return res diff --git a/base_group_internal/pyproject.toml b/base_group_internal/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/base_group_internal/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/base_group_internal/readme/CONTRIBUTORS.md b/base_group_internal/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..f4804ed6c --- /dev/null +++ b/base_group_internal/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [NuoBiT](https://www.nuobit.com): + - Kilian Niubo \<\> diff --git a/base_group_internal/readme/DESCRIPTION.md b/base_group_internal/readme/DESCRIPTION.md new file mode 100644 index 000000000..68747c895 --- /dev/null +++ b/base_group_internal/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module extends base to include security features. diff --git a/base_group_internal/static/description/icon.png b/base_group_internal/static/description/icon.png new file mode 100644 index 000000000..1cd641e79 Binary files /dev/null and b/base_group_internal/static/description/icon.png differ diff --git a/base_group_internal/static/description/index.html b/base_group_internal/static/description/index.html new file mode 100644 index 000000000..13b7ddf82 --- /dev/null +++ b/base_group_internal/static/description/index.html @@ -0,0 +1,418 @@ + + + + + +Base Group Internal + + + +
+

Base Group Internal

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+

This module extends base to include security features.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • NuoBiT Solutions SL
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the NuoBiT/odoo-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/base_group_internal/views/res_groups_views.xml b/base_group_internal/views/res_groups_views.xml new file mode 100644 index 000000000..df940d586 --- /dev/null +++ b/base_group_internal/views/res_groups_views.xml @@ -0,0 +1,16 @@ + + + + base.group.internal.res.groups.view.form + res.groups + + + + + + + + + + +