Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17.0 mig res users clear access rights #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/17.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:%2017.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/17.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": "17.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"],
}
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
3 changes: 3 additions & 0 deletions res_users_clear_access_rights/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
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>
Loading