feat: Implement user access rights export wizard.

This commit is contained in:
admin.suherdy 2025-12-06 19:11:08 +07:00
parent 01f4ad9971
commit efc79d193a
10 changed files with 694 additions and 694 deletions

View File

@ -1,32 +1,32 @@
# User Access Rights Export # User Access Rights Export
Generate an Excel workbook that consolidates the access rights of every user in your Odoo 17 instance. Generate an Excel workbook that consolidates the access rights of every user in your Odoo 17 instance.
## Features ## Features
* One-click wizard accessible to system administrators. * One-click wizard accessible to system administrators.
* Summary worksheet listing all users with counts of granted ACLs and record rules. * Summary worksheet listing all users with counts of granted ACLs and record rules.
* Summary worksheet listing each security group with user counts, ACL totals, and record rule totals. * Summary worksheet listing each security group with user counts, ACL totals, and record rule totals.
* Dedicated worksheet per user including: * Dedicated worksheet per user including:
* Model access control list (CRUD) permissions derived from `ir.model.access`. * Model access control list (CRUD) permissions derived from `ir.model.access`.
* Record rule visibility and domain definitions from `ir.rule`. * Record rule visibility and domain definitions from `ir.rule`.
* Dedicated worksheet per security group including: * Dedicated worksheet per security group including:
* Group-specific ACL permissions. * Group-specific ACL permissions.
* Record rules that apply to the group. * Record rules that apply to the group.
* Workbook generated entirely in-memory using `xlsxwriter`. * Workbook generated entirely in-memory using `xlsxwriter`.
## Installation ## Installation
1. Copy the `user_access_rights_export` directory into your Odoo addons path. 1. Copy the `user_access_rights_export` directory into your Odoo addons path.
2. Update your addons list and install the module via Apps. 2. Update your addons list and install the module via Apps.
3. Requires the Python package `xlsxwriter` (bundled with standard Odoo installations). 3. Requires the Python package `xlsxwriter` (bundled with standard Odoo installations).
## Usage ## Usage
1. Navigate to **Settings → Technical → User Access Rights Export**. 1. Navigate to **Settings → Technical → User Access Rights Export**.
2. Click **Generate**. The module will produce and download an `.xlsx` file. 2. Click **Generate**. The module will produce and download an `.xlsx` file.
3. Open the Excel file to inspect summary metrics and per-user details. 3. Open the Excel file to inspect summary metrics and per-user details.
## Security ## Security
Only members of the **Settings / Technical (System Administrator)** group can execute the export wizard. Only members of the **Settings / Technical (System Administrator)** group can execute the export wizard.

View File

@ -1,2 +1,2 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import wizard from . import wizard

View File

@ -1,34 +1,34 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
{ {
"name": "User Access Rights Export", "name": "User Access Rights Export",
"version": "17.0.1.0.0", "version": "17.0.1.0.0",
"category": "Settings/Technical", "category": "Settings/Technical",
"summary": "Export detailed user access rights (model ACLs and record rules) to Excel", "summary": "Export detailed user access rights (model ACLs and record rules) to Excel",
"description": """ "description": """
User Access Rights Export User Access Rights Export
========================= =========================
Generate an Excel workbook detailing the access rights of all internal users. Generate an Excel workbook detailing the access rights of all internal users.
Features Features
-------- --------
* Summary worksheet with key metrics per user. * Summary worksheet with key metrics per user.
* Dedicated worksheet per user including: * Dedicated worksheet per user including:
- Model access rights (CRUD permissions). - Model access rights (CRUD permissions).
- Record rules with domains and permissions. - Record rules with domains and permissions.
* XLSX output generated in-memory via xlsxwriter. * XLSX output generated in-memory via xlsxwriter.
""", """,
"author": "Suherdy Yacob", "author": "Suherdy Yacob",
"website": "https://www.example.com", "website": "https://www.example.com",
"license": "LGPL-3", "license": "LGPL-3",
"depends": [ "depends": [
"base", "base",
], ],
"data": [ "data": [
"security/ir.model.access.csv", "security/ir.model.access.csv",
"views/user_access_rights_wizard_views.xml", "views/user_access_rights_wizard_views.xml",
], ],
"installable": True, "installable": True,
"application": False, "application": False,
"auto_install": False, "auto_install": False,
} }

Binary file not shown.

View File

@ -1,2 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_user_access_rights_wizard,user.access.rights.wizard,model_user_access_rights_wizard,base.group_system,1,1,1,1 access_user_access_rights_wizard,user.access.rights.wizard,model_user_access_rights_wizard,base.group_system,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_user_access_rights_wizard user.access.rights.wizard model_user_access_rights_wizard base.group_system 1 1 1 1

View File

@ -1,46 +1,46 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="view_user_access_rights_wizard_form" model="ir.ui.view"> <record id="view_user_access_rights_wizard_form" model="ir.ui.view">
<field name="name">user.access.rights.wizard.form</field> <field name="name">user.access.rights.wizard.form</field>
<field name="model">user.access.rights.wizard</field> <field name="model">user.access.rights.wizard</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Export User Access Rights"> <form string="Export User Access Rights">
<sheet> <sheet>
<group col="1" class="o_form_full_width"> <group col="1" class="o_form_full_width">
<separator string="Overview" colspan="1"/> <separator string="Overview" colspan="1"/>
<div class="o_form_description"> <div class="o_form_description">
<p><strong>Generate a consolidated Excel workbook of user access rights.</strong></p> <p><strong>Generate a consolidated Excel workbook of user access rights.</strong></p>
<ul class="o_form_list"> <ul class="o_form_list">
<li>Includes model ACL permissions (Read, Write, Create, Delete) per user.</li> <li>Includes model ACL permissions (Read, Write, Create, Delete) per user.</li>
<li>Captures applicable record rules and their domains.</li> <li>Captures applicable record rules and their domains.</li>
<li>Download starts automatically once the report is ready.</li> <li>Download starts automatically once the report is ready.</li>
</ul> </ul>
</div> </div>
</group> </group>
<group col="2" modifiers="{'invisible': [('excel_file', '=', False)]}"> <group col="2" modifiers="{'invisible': [('excel_file', '=', False)]}">
<field name="filename" readonly="1" string="Generated File"/> <field name="filename" readonly="1" string="Generated File"/>
<field name="excel_file" filename="filename" invisible="1"/> <field name="excel_file" filename="filename" invisible="1"/>
</group> </group>
</sheet> </sheet>
<footer> <footer>
<button string="Generate" type="object" name="action_generate_report" class="btn-primary"/> <button string="Generate" type="object" name="action_generate_report" class="btn-primary"/>
<button string="Close" special="cancel" class="btn-secondary"/> <button string="Close" special="cancel" class="btn-secondary"/>
</footer> </footer>
</form> </form>
</field> </field>
</record> </record>
<record id="action_user_access_rights_wizard" model="ir.actions.act_window"> <record id="action_user_access_rights_wizard" model="ir.actions.act_window">
<field name="name">Export User Access Rights</field> <field name="name">Export User Access Rights</field>
<field name="res_model">user.access.rights.wizard</field> <field name="res_model">user.access.rights.wizard</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</field> <field name="target">new</field>
</record> </record>
<menuitem id="menu_user_access_rights_export_root" <menuitem id="menu_user_access_rights_export_root"
name="User Access Rights Export" name="User Access Rights Export"
parent="base.menu_custom" parent="base.menu_custom"
sequence="50" sequence="50"
action="action_user_access_rights_wizard" action="action_user_access_rights_wizard"
groups="base.group_system"/> groups="base.group_system"/>
</odoo> </odoo>

View File

@ -1,2 +1,2 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import user_access_rights_wizard from . import user_access_rights_wizard

Binary file not shown.

File diff suppressed because it is too large Load Diff