|
| 1 | +==================================== |
| 2 | +Permissions & Access Rule Visualizer |
| 3 | +==================================== |
| 4 | + |
| 5 | +.. |
| 6 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 7 | + !! This file is generated by oca-gen-addon-readme !! |
| 8 | + !! changes will be overwritten. !! |
| 9 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 10 | + !! source digest: sha256:d30227088b2ac95369cb4df9493b310d7b88fe6a848f15fd3307714a6417f71a |
| 11 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 12 | +
|
| 13 | +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png |
| 14 | + :target: https://odoo-community.org/page/development-status |
| 15 | + :alt: Beta |
| 16 | +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png |
| 17 | + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
| 18 | + :alt: License: AGPL-3 |
| 19 | +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github |
| 20 | + :target: https://github.com/OCA/server-tools/tree/16.0/security_visualizer |
| 21 | + :alt: OCA/server-tools |
| 22 | +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png |
| 23 | + :target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-security_visualizer |
| 24 | + :alt: Translate me on Weblate |
| 25 | +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png |
| 26 | + :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0 |
| 27 | + :alt: Try me on Runboat |
| 28 | + |
| 29 | +|badge1| |badge2| |badge3| |badge4| |badge5| |
| 30 | + |
| 31 | +This module provides a comprehensive security visualization and |
| 32 | +debugging tool for Odoo. It makes Odoo's complex security system |
| 33 | +(``ir.model.access`` and ``ir.rule``) understandable and debuggable. |
| 34 | + |
| 35 | +**Problem** |
| 36 | + |
| 37 | +Odoo's security system is powerful but notoriously difficult to |
| 38 | +understand and debug: |
| 39 | + |
| 40 | +- Access rules are invisible and complex |
| 41 | +- Debugging security is painful |
| 42 | +- Small mistakes cause major data leaks or access blocks |
| 43 | +- No clear way to answer "Why can't user X access record Y?" |
| 44 | + |
| 45 | +**Solution** |
| 46 | + |
| 47 | +This module provides: |
| 48 | + |
| 49 | +1. **Security Analyzer** - Detailed analysis of access decisions |
| 50 | +2. **Access Matrix** - Visual grid showing user × model × operation |
| 51 | + permissions |
| 52 | +3. **Rule Explainer** - Step-by-step breakdown of security checks |
| 53 | +4. **Safe Simulation** - Test access as any user without risk |
| 54 | +5. **Multi-Company Analysis** - Understand company-specific security |
| 55 | + rules |
| 56 | +6. **Role-Based Access** - Analyze access through user roles (requires |
| 57 | + base_user_role module) |
| 58 | + |
| 59 | +**Table of contents** |
| 60 | + |
| 61 | +.. contents:: |
| 62 | + :local: |
| 63 | + |
| 64 | +Configuration |
| 65 | +============= |
| 66 | + |
| 67 | +No configuration needed. After installation, access the module via: |
| 68 | + |
| 69 | +**Menu Location**: Settings > Technical > Security > Security Visualizer |
| 70 | + |
| 71 | +1. **Security Dashboard** - Main interactive visualizer |
| 72 | +2. **Quick Analyzer** - Simple wizard for quick analysis |
| 73 | + |
| 74 | +Access Control |
| 75 | +-------------- |
| 76 | + |
| 77 | +By default, only users in the **Settings** group (``base.group_system``) |
| 78 | +can access this module. |
| 79 | + |
| 80 | +This ensures that sensitive security information is only visible to |
| 81 | +system administrators. |
| 82 | + |
| 83 | +Multi-Company Configuration |
| 84 | +--------------------------- |
| 85 | + |
| 86 | +The multi-company analysis feature works automatically if your Odoo |
| 87 | +instance uses multiple companies: |
| 88 | + |
| 89 | +- **No additional configuration needed** |
| 90 | +- Analysis automatically detects models with ``company_id`` fields |
| 91 | +- Shows which companies each user belongs to |
| 92 | +- Identifies company-specific record rules |
| 93 | + |
| 94 | +Role-Based Access (Optional) |
| 95 | +---------------------------- |
| 96 | + |
| 97 | +To use the role-based access analysis feature: |
| 98 | + |
| 99 | +1. **Install base_user_role module**: |
| 100 | + |
| 101 | + .. code:: bash |
| 102 | +
|
| 103 | + # The module is typically available from OCA |
| 104 | + # Add the OCA server-backend repository to your addons path |
| 105 | +
|
| 106 | +2. **Assign roles to users**: |
| 107 | + |
| 108 | + - Go to **Settings > Users & Companies > Roles** |
| 109 | + - Create roles with appropriate groups |
| 110 | + - Assign roles to users |
| 111 | + |
| 112 | +3. **Use the analyzer**: |
| 113 | + |
| 114 | + - The Security Visualizer will automatically detect installed roles |
| 115 | + - Analysis will include role information |
| 116 | + - See which roles grant access to models |
| 117 | + |
| 118 | +If ``base_user_role`` is not installed: |
| 119 | + |
| 120 | +- The module works normally without role features |
| 121 | +- Role-related methods return appropriate status messages |
| 122 | +- All other features remain fully functional |
| 123 | + |
| 124 | +Usage |
| 125 | +===== |
| 126 | + |
| 127 | +Analyze Specific Access |
| 128 | +----------------------- |
| 129 | + |
| 130 | +1. Open **Security Visualizer** from **Settings > Technical > Security > |
| 131 | + Security Dashboard** |
| 132 | +2. Select a **User** from the dropdown |
| 133 | +3. Select a **Model** (e.g., ``sale.order``) |
| 134 | +4. Choose an **Operation** (read, write, create, delete) |
| 135 | +5. Optionally enter a **Record ID** for specific record testing |
| 136 | +6. Click **Analyze Access** |
| 137 | +7. Review the detailed step-by-step explanation |
| 138 | + |
| 139 | +View Access Matrix |
| 140 | +------------------ |
| 141 | + |
| 142 | +1. Open **Security Dashboard** from **Settings > Technical > Security** |
| 143 | +2. Click the **Access Matrix** tab |
| 144 | +3. Use the operation dropdown to filter by read/write/create/delete |
| 145 | +4. Green checkmark = access allowed, Red X = access denied |
| 146 | +5. Click any cell to see detailed analysis (coming in next version) |
| 147 | + |
| 148 | +Quick Analysis |
| 149 | +-------------- |
| 150 | + |
| 151 | +1. Go to **Settings > Technical > Security > Quick Analyzer** |
| 152 | +2. Fill in the form (user, model, operation, optional record ID) |
| 153 | +3. Click **Analyze** |
| 154 | +4. View results in HTML summary and JSON format |
| 155 | + |
| 156 | +Understanding the Analysis |
| 157 | +-------------------------- |
| 158 | + |
| 159 | +**Step 1: Model-Level Access (ACL)** |
| 160 | + |
| 161 | +Shows all ``ir.model.access`` rules that apply: |
| 162 | + |
| 163 | +- Which groups grant permission |
| 164 | +- Which specific CRUD operations are allowed |
| 165 | +- Whether the user has the required group membership |
| 166 | + |
| 167 | +**Step 2: Record Rules** |
| 168 | + |
| 169 | +Shows ``ir.rule`` domain filters: |
| 170 | + |
| 171 | +- **Global rules** (no groups): ALL must be satisfied - AND logic |
| 172 | +- **Group rules**: ANY can grant access - OR logic |
| 173 | +- Displays actual domain syntax for each rule |
| 174 | + |
| 175 | +**Step 3: Simulation Result** |
| 176 | + |
| 177 | +If a record ID is provided: |
| 178 | + |
| 179 | +- Tests actual access on that specific record |
| 180 | +- Safe, read-only simulation |
| 181 | +- Clear explanation of final verdict (Allowed/Denied/Conditional) |
| 182 | + |
| 183 | +Multi-Company Security Analysis |
| 184 | +------------------------------- |
| 185 | + |
| 186 | +**Analyze Company-Specific Access** |
| 187 | + |
| 188 | +1. Open **Security Visualizer** |
| 189 | +2. Use the multi-company analysis feature (via RPC methods) |
| 190 | +3. View which companies a user can access data from |
| 191 | +4. See company-related record rules |
| 192 | + |
| 193 | +The analysis shows: |
| 194 | + |
| 195 | +- User's assigned companies |
| 196 | +- Current active company |
| 197 | +- Models with company_id field |
| 198 | +- Company-specific record rules |
| 199 | +- Which companies grant access to records |
| 200 | + |
| 201 | +**Company Access Matrix** |
| 202 | + |
| 203 | +Generate a matrix showing: |
| 204 | + |
| 205 | +- User x Company x Model permissions |
| 206 | +- Which companies the user can access for each model |
| 207 | +- Company-specific rule counts |
| 208 | + |
| 209 | +Role-Based Access Analysis |
| 210 | +-------------------------- |
| 211 | + |
| 212 | +**Prerequisites** |
| 213 | + |
| 214 | +This feature requires the ``base_user_role`` module to be installed. |
| 215 | + |
| 216 | +**Analyze User Roles** |
| 217 | + |
| 218 | +1. Open **Security Visualizer** |
| 219 | +2. Select a user |
| 220 | +3. View their assigned roles |
| 221 | +4. See which groups each role grants |
| 222 | +5. Distinguish between role-based and direct group assignments |
| 223 | + |
| 224 | +The analysis shows: |
| 225 | + |
| 226 | +- All roles assigned to the user |
| 227 | +- Groups granted by each role |
| 228 | +- Groups assigned directly (not through roles) |
| 229 | +- Total effective groups |
| 230 | + |
| 231 | +**Model Access with Roles** |
| 232 | + |
| 233 | +When analyzing model access: |
| 234 | + |
| 235 | +- See which roles grant access to the model |
| 236 | +- Understand access through role hierarchy |
| 237 | +- Identify if access is via role or direct group |
| 238 | + |
| 239 | +**Enhanced Explanations** |
| 240 | + |
| 241 | +Access decisions now include: |
| 242 | + |
| 243 | +- Step 0: User Roles (if roles are assigned) |
| 244 | +- Which specific roles grant the required permission |
| 245 | +- Whether access is role-based or direct |
| 246 | + |
| 247 | +Bug Tracker |
| 248 | +=========== |
| 249 | + |
| 250 | +Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_. |
| 251 | +In case of trouble, please check there if your issue has already been reported. |
| 252 | +If you spotted it first, help us to smash it by providing a detailed and welcomed |
| 253 | +`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20security_visualizer%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
| 254 | + |
| 255 | +Do not contact contributors directly about support or help with technical issues. |
| 256 | + |
| 257 | +Credits |
| 258 | +======= |
| 259 | + |
| 260 | +Authors |
| 261 | +------- |
| 262 | + |
| 263 | +* Kobros-Tech |
| 264 | + |
| 265 | +Contributors |
| 266 | +------------ |
| 267 | + |
| 268 | +- Mohamed Alkobrosli mohamed@kobros-tech.com |
| 269 | + (`Kobros-Tech <https://kobros-tech.com/>`__) |
| 270 | + |
| 271 | +Other credits |
| 272 | +------------- |
| 273 | + |
| 274 | +**Development** |
| 275 | + |
| 276 | +This module was developed by **Kobros-Tech** (https://kobros-tech.com/) |
| 277 | +to address the common challenge of understanding and debugging Odoo's |
| 278 | +security system. |
| 279 | + |
| 280 | +Maintainers |
| 281 | +----------- |
| 282 | + |
| 283 | +This module is maintained by the OCA. |
| 284 | + |
| 285 | +.. image:: https://odoo-community.org/logo.png |
| 286 | + :alt: Odoo Community Association |
| 287 | + :target: https://odoo-community.org |
| 288 | + |
| 289 | +OCA, or the Odoo Community Association, is a nonprofit organization whose |
| 290 | +mission is to support the collaborative development of Odoo features and |
| 291 | +promote its widespread use. |
| 292 | + |
| 293 | +This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/security_visualizer>`_ project on GitHub. |
| 294 | + |
| 295 | +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
0 commit comments