diff --git a/base_suspend_security/README.rst b/base_suspend_security/README.rst index 60297e63..af5e26d7 100644 --- a/base_suspend_security/README.rst +++ b/base_suspend_security/README.rst @@ -1,13 +1,39 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 - +================ Suspend security ================ +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fserver--backend-lightgray.png?logo=github + :target: https://github.com/OCA/server-backend/tree/12.0-mig-base_suspend_security/base_suspend_security + :alt: OCA/server-backend +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/server-backend-12-0-mig-base_suspend_security/server-backend-12-0-mig-base_suspend_security-base_suspend_security + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/253/12.0-mig-base_suspend_security + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module was written to allow you to call code with some `uid` while being sure no security checks (`ir.model.access` and `ir.rule`) are done. In this way, it's the same as `sudo()`, but the crucial difference is that the code still runs with the original user id. This can be important for inherited code that calls workflow functions, subscribes the current user to some object, etc. Usually, you'll be in in the situation to want something like this if you inherit from a module you can't or don't want to change, and call `super()`. +**Table of contents** + +.. contents:: + :local: + Usage ===== @@ -30,29 +56,40 @@ 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 smashing it by providing a detailed and welcomed feedback. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Therp BV +* brain-tec AG + Contributors ------------- +~~~~~~~~~~~~ * Holger Brunn * Laurent Mignon * Frédéric Garbely -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit http://odoo-community.org. +This module is part of the `OCA/server-backend `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_suspend_security/__init__.py b/base_suspend_security/__init__.py index c450fc83..8b959ae6 100644 --- a/base_suspend_security/__init__.py +++ b/base_suspend_security/__init__.py @@ -1,19 +1,3 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV . -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/base_suspend_security/__manifest__.py b/base_suspend_security/__manifest__.py index d2ac3ddf..96c494a9 100644 --- a/base_suspend_security/__manifest__.py +++ b/base_suspend_security/__manifest__.py @@ -1,24 +1,8 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV . -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Suspend security", - "version": "11.0.1.0.1", + "version": "12.0.1.0.0", "author": "Therp BV, brain-tec AG, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Hidden/Dependency", diff --git a/base_suspend_security/base_suspend_security.py b/base_suspend_security/base_suspend_security.py index caba4756..f8712f77 100644 --- a/base_suspend_security/base_suspend_security.py +++ b/base_suspend_security/base_suspend_security.py @@ -1,21 +1,5 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV . -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo.tools import pycompat diff --git a/base_suspend_security/models/__init__.py b/base_suspend_security/models/__init__.py index 861ec124..6a052bd2 100644 --- a/base_suspend_security/models/__init__.py +++ b/base_suspend_security/models/__init__.py @@ -1,21 +1,5 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV . -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import base from . import ir_model_access from . import ir_rule diff --git a/base_suspend_security/models/ir_model_access.py b/base_suspend_security/models/ir_model_access.py index f90d3dd4..d3dc9028 100644 --- a/base_suspend_security/models/ir_model_access.py +++ b/base_suspend_security/models/ir_model_access.py @@ -1,21 +1,5 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, models, tools from ..base_suspend_security import BaseSuspendSecurityUid diff --git a/base_suspend_security/models/ir_rule.py b/base_suspend_security/models/ir_rule.py index 111430f3..8cd8d39c 100644 --- a/base_suspend_security/models/ir_rule.py +++ b/base_suspend_security/models/ir_rule.py @@ -1,21 +1,5 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import api, models from ..base_suspend_security import BaseSuspendSecurityUid diff --git a/base_suspend_security/models/res_users.py b/base_suspend_security/models/res_users.py index e7b16e90..c0741deb 100644 --- a/base_suspend_security/models/res_users.py +++ b/base_suspend_security/models/res_users.py @@ -1,21 +1,5 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import models from ..base_suspend_security import BaseSuspendSecurityUid diff --git a/base_suspend_security/readme/CONTRIBUTORS.rst b/base_suspend_security/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..b82b9788 --- /dev/null +++ b/base_suspend_security/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Holger Brunn +* Laurent Mignon +* Frédéric Garbely diff --git a/base_suspend_security/readme/DESCRIPTION.rst b/base_suspend_security/readme/DESCRIPTION.rst new file mode 100644 index 00000000..36a275d1 --- /dev/null +++ b/base_suspend_security/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module was written to allow you to call code with some `uid` while being sure no security checks (`ir.model.access` and `ir.rule`) are done. In this way, it's the same as `sudo()`, but the crucial difference is that the code still runs with the original user id. This can be important for inherited code that calls workflow functions, subscribes the current user to some object, etc. + +Usually, you'll be in in the situation to want something like this if you inherit from a module you can't or don't want to change, and call `super()`. diff --git a/base_suspend_security/readme/ROADMAP.rst b/base_suspend_security/readme/ROADMAP.rst new file mode 100644 index 00000000..5f6315c5 --- /dev/null +++ b/base_suspend_security/readme/ROADMAP.rst @@ -0,0 +1 @@ +* the magic works by wrapping uid in a marker class, so if some code unwraps this in the calling tree, security checks will be reenabled diff --git a/base_suspend_security/readme/USAGE.rst b/base_suspend_security/readme/USAGE.rst new file mode 100644 index 00000000..7585ad19 --- /dev/null +++ b/base_suspend_security/readme/USAGE.rst @@ -0,0 +1,8 @@ +To use this module, you need to: + +* depend on this module +* call `yourmodel.suspend_security().function_to_run()`, just the same as you would use `sudo()` + +For further information, please visit: + +* https://www.odoo.com/forum/help-1 diff --git a/base_suspend_security/static/description/index.html b/base_suspend_security/static/description/index.html new file mode 100644 index 00000000..4ab20f39 --- /dev/null +++ b/base_suspend_security/static/description/index.html @@ -0,0 +1,443 @@ + + + + + + +Suspend security + + + +
+

Suspend security

+ + +

Beta License: AGPL-3 OCA/server-backend Translate me on Weblate Try me on Runbot

+

This module was written to allow you to call code with some uid while being sure no security checks (ir.model.access and ir.rule) are done. In this way, it’s the same as sudo(), but the crucial difference is that the code still runs with the original user id. This can be important for inherited code that calls workflow functions, subscribes the current user to some object, etc.

+

Usually, you’ll be in in the situation to want something like this if you inherit from a module you can’t or don’t want to change, and call super().

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  • depend on this module
  • +
  • call yourmodel.suspend_security().function_to_run(), just the same as you would use sudo()
  • +
+

For further information, please visit:

+ +
+
+

Known issues / Roadmap

+
    +
  • the magic works by wrapping uid in a marker class, so if some code unwraps this in the calling tree, security checks will be reenabled
  • +
+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Therp BV
  • +
  • brain-tec AG
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/server-backend project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/base_suspend_security/tests/__init__.py b/base_suspend_security/tests/__init__.py index af8225bd..a278bab5 100644 --- a/base_suspend_security/tests/__init__.py +++ b/base_suspend_security/tests/__init__.py @@ -1,19 +1,3 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV . -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_base_suspend_security diff --git a/base_suspend_security/tests/test_base_suspend_security.py b/base_suspend_security/tests/test_base_suspend_security.py index 82d15b9a..ff2fd658 100644 --- a/base_suspend_security/tests/test_base_suspend_security.py +++ b/base_suspend_security/tests/test_base_suspend_security.py @@ -1,21 +1,5 @@ -############################################################################## -# -# This module copyright (C) 2015 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# © 2015 Therp BV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import exceptions from odoo.tests.common import TransactionCase diff --git a/setup/base_suspend_security/odoo/addons/base_suspend_security b/setup/base_suspend_security/odoo/addons/base_suspend_security new file mode 120000 index 00000000..5b117c63 --- /dev/null +++ b/setup/base_suspend_security/odoo/addons/base_suspend_security @@ -0,0 +1 @@ +../../../../base_suspend_security \ No newline at end of file diff --git a/setup/base_suspend_security/setup.py b/setup/base_suspend_security/setup.py new file mode 100644 index 00000000..1dfc4114 --- /dev/null +++ b/setup/base_suspend_security/setup.py @@ -0,0 +1,7 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) +