Skip to content

Commit

Permalink
[ADD] res_users_clear_access_rights
Browse files Browse the repository at this point in the history
Co-authored-by: Stanislav Krotov <[email protected]>
Co-authored-by: Ivan Yelizariev <[email protected]>
Co-authored-by: Ilya Ilchenko <[email protected]>
Co-authored-by: Artem Rafailov <[email protected]>
Co-authored-by: Eugene Molotov <[email protected]>
  • Loading branch information
6 people committed Oct 10, 2024
1 parent 8de4002 commit 3fb29af
Show file tree
Hide file tree
Showing 19 changed files with 296 additions and 0 deletions.
67 changes: 67 additions & 0 deletions res_users_clear_access_rights/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
========================
Clear User Access rights
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c522ee2ec53e002b0413947d3ddf0cb4b87012877df76710f21e3c34a22fe569
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-it--projects--llc%2Faccess--addons-lightgray.png?logo=github
:target: https://github.com/it-projects-llc/access-addons/tree/14.0/res_users_clear_access_rights
:alt: it-projects-llc/access-addons

|badge1| |badge2| |badge3|

There is an inheritance in access right groups. Some time you try untick
something, but after clicking "Save" button you get tick back. In that
case it's better to untick all rights and start access rights
configuration from scratch. This module helps to do it.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/it-projects-llc/access-addons/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/it-projects-llc/access-addons/issues/new?body=module:%20res_users_clear_access_rights%0Aversion:%2014.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
-------

* IT-Projects LLC

Contributors
------------

- Stanislav Krotov (https://github.com/ufaks)
- Ivan Yelizariev (https://github.com/yelizariev)
- Ilya Ilchenko (https://github.com/mentalko)
- Artem Rafailov (https://github.com/Ommo73)
- Eugene Molotov (https://github.com/em230418)

Maintainers
-----------

This module is part of the `it-projects-llc/access-addons <https://github.com/it-projects-llc/access-addons/tree/14.0/res_users_clear_access_rights>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions res_users_clear_access_rights/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions res_users_clear_access_rights/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "Clear User Access rights",
"summary": """Useful tool to reset user rights""",
"version": "14.0.1.1.0",
"author": "IT-Projects LLC",
"license": "LGPL-3",
"support": "[email protected]",
"website": "https://github.com/it-projects-llc/access-addons",
"category": "Access",
"images": ["images/clear_user_access_rights.jpg"],
"depends": ["base"],
"data": ["views.xml"],
}
9 changes: 9 additions & 0 deletions res_users_clear_access_rights/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
`1.1.0`
-------

- **New**: does not clear user type when clear access rights

`1.0.0`
-------

- Init version
8 changes: 8 additions & 0 deletions res_users_clear_access_rights/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==========================
Clear User Access rights
==========================

Installation
============

* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
31 changes: 31 additions & 0 deletions res_users_clear_access_rights/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * res_users_clear_access_rights
#
# Translators:
# Dawid Runowski <[email protected]>, 2019
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-26 19:17+0000\n"
"PO-Revision-Date: 2017-12-05 05:26+0000\n"
"Last-Translator: Dawid Runowski <[email protected]>, 2019\n"
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/"
"de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: res_users_clear_access_rights
#: model:ir.ui.view,arch_db:res_users_clear_access_rights.view_users_form
msgid "Clear access rights"
msgstr ""

#. module: res_users_clear_access_rights
#: model:ir.model,name:res_users_clear_access_rights.model_res_users
msgid "Users"
msgstr "Benutzer"
30 changes: 30 additions & 0 deletions res_users_clear_access_rights/i18n/es_CR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * res_users_clear_access_rights
#
# Translators:
# Randall <[email protected]>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-26 19:17+0000\n"
"PO-Revision-Date: 2018-04-26 19:17+0000\n"
"Last-Translator: Randall <[email protected]>, 2018\n"
"Language-Team: Spanish (Costa Rica) (https://www.transifex.com/it-projects-"
"llc/teams/76080/es_CR/)\n"
"Language: es_CR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: res_users_clear_access_rights
#: model:ir.ui.view,arch_db:res_users_clear_access_rights.view_users_form
msgid "Clear access rights"
msgstr "Limpiar accesos permitidos"

#. module: res_users_clear_access_rights
#: model:ir.model,name:res_users_clear_access_rights.model_res_users
msgid "Users"
msgstr "Usuarios"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * res_users_clear_access_rights
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: res_users_clear_access_rights
#: model_terms:ir.ui.view,arch_db:res_users_clear_access_rights.view_users_form
msgid "Clear access rights"
msgstr ""

#. module: res_users_clear_access_rights
#: model:ir.model,name:res_users_clear_access_rights.model_res_users
msgid "Users"
msgstr ""

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions res_users_clear_access_rights/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from odoo import models


class ResUsers(models.Model):
_inherit = "res.users"

def action_clear_access_rights(self):
self.ensure_one()
admin_groups = [
self.env.ref("base.group_user").id,
self.env.ref("base.group_erp_manager").id,
self.env.ref("base.group_system").id,
]

user_types = [
self.env.ref("base.group_portal").id,
self.env.ref("base.group_public").id,
self.env.ref("base.group_user").id,
]

groups_id = []
for g in self.groups_id:
if self.env.uid == self.id and g.id in admin_groups or g.id in user_types:
# don't allow for Administrator to clear his admin rights
# don't clear user type
continue
groups_id.append((3, g.id))
self.write({"groups_id": groups_id})
return True
5 changes: 5 additions & 0 deletions res_users_clear_access_rights/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Stanislav Krotov (https://github.com/ufaks)
- Ivan Yelizariev (https://github.com/yelizariev)
- Ilya Ilchenko (https://github.com/mentalko)
- Artem Rafailov (https://github.com/Ommo73)
- Eugene Molotov (https://github.com/em230418)
4 changes: 4 additions & 0 deletions res_users_clear_access_rights/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
There is an inheritance in access right groups. Some time you try untick something,
but after clicking "Save" button you get tick back.
In that case it's better to untick all rights and start access rights configuration from scratch.
This module helps to do it.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions res_users_clear_access_rights/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Clear User Access rights</h2>
<h3 class="oe_slogan">Useful tool to reset user rights</h3>
</div>

<div class="oe_span12">
<p class="oe_mt32">
There is an inheritance in access right groups. Some time you try untick something, but after clicking "Save" button you get tick back. In that case it's better to untick all rights and start access rights configuration from scratch. This module helps to do it.
</p>
</div>

<div class="oe_span12">
<div class="oe_picture">
<img src="before.png?2"/>
</div>
<p>After clearing:</p>
<div class="oe_picture">
<img src="after.png?3"/>
</div>
</div>

<div class="oe_span12">
<p class="oe_mt32">
The only exception is keeping administration rights for current user (i.e. for your user). If you try to do it, access rights "Administration: Settings" and "Humar Resources: Employee" would be still there, while everything else would be removed.
</p>
</div>

</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2>Need our service?</h2>
<p class="oe_mt32">Contact us by <a href="mailto:[email protected]">email</a> or fill out <a href="https://www.it-projects.info/page/website.contactus " target="_blank">request form</a></p>
<ul>
<li><a href="mailto:[email protected]">[email protected] <i class="fa fa-envelope-o"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">
https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
<li><a href="https://m.me/itprojectsllc" target="_blank">https://m.me/itprojectsllc <i class="fa fa-facebook-square"></i></a></li>
<li>[email protected] <i class="fa fa-skype"></i></li>
</ul>
</div>
</div>
</section>
20 changes: 20 additions & 0 deletions res_users_clear_access_rights/views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_users_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='access_rights']/group[1]" position="before">
<button
string="Clear access rights"
type="object"
name="action_clear_access_rights"
style="margin-top: 10px;"
/>
</xpath>
</data>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/res_users_clear_access_rights/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 3fb29af

Please sign in to comment.