summaryrefslogtreecommitdiff
path: root/odoo/addons/base/security/base_security.xml
AgeCommit message (Collapse)Author
2020-10-29[FIX] base: verify the rights on individual records tooMartin Trigaux
The access rights of a model was checked but not the records themself. In case a user has access to a model but not to a specific record, he should not be able to execute a server action on it. Correct the ir.rule on private partners to be also verified for other operations than read. While it was not possible to actually write on it (due to side effects of ORM where write implies a read operation), check_access_rule('write') was working on a private address closes odoo/odoo#59740 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-08-31[IMP] base: Move the private address, group to technical categoryNisha patel
Currently, the access to private addresses group show in the other category in user form view and due to that it is visible in non-debug mode too. So in this commit, Move the private addresses group to tehcnical category so it should visible in debug mode only. closes odoo/odoo#56491 Task-id: 2318509 Related: odoo/enterprise#12646 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-08-14[ADD] base: API keys supportXavier Morel
* ability for a user to request / create keys associated to their user * overrides can block RPC solely through API keys, by overriding `_rpc_api_keys_only()` (to require API auth even in situations where the user has not requested it themselves) * hash keys just in case as we can do so and might as well, add a cleartext index (first 4 bytes of 20) to avoid blowing up the DB if a user decides to create millions of keys for some daft reason * users can delete their own keys, admins can delete (invalidate) anyone's keys * `scope` on API keys can be used to restrict usage to certain kind of applications, so API keys can be used for other things than global authentication. New keys manually created by users have no scope by default so they are valid everywhere (global keys). RPC auth (stateless XML-RPC/JSON-RPC) requires global keys Co-authored-by: Florimond Husquinet <fhu@odoo.com> Co-authored-by: Olivier Dony <odo@odoo.com>
2020-08-14[ADD] base: enhanced security mode for usersXavier Morel
Similar to github's sudo mode, my understanding of the intent is to avoid third parties being able to perform sensitive / serious operations when leaving a logged-in machine unattended. This v1 only handles protecting "action methods" (methods called through buttons and intended to return action descriptors), although they can be used to "lock out" any methods they won't be able to prompt and the caller will likely be surprised.
2020-03-20[IMP] *: remove global field definition in ir rules xmlVictor Feyens
It is a computed field, there is no need to manually set its value.
2020-02-04[ADD] *: add ir.model.access on all transient modelsMartin Trigaux
Following changes needing ir.model.access on transient models too. Remove groups declaration on the action to move it to ir.model.access when possible. Rules are strict by default with no unlink access by default and high priviledge asked. Adaptations may be needed later. Write access is given as a wizard may need to be modified in case the action triggers an error and the user has to correct a value account*: use account.group_account_user for all transient by default remove account.print.journal relic stock*: use stock.group_stock_user by default survey: survey user can send invitations mail: allow any employee to execute wizards additional verifications are made to ensure they are executed only on the documents the user has access to you give portal access to mail.compose.message as portal still does some actions like posting messages on the forum add ir.rule to avoid reading somebody else messages increase the query count because of undeterminist count crm: saleman for lead2opp, manager for massmailing partner manager for actions linked to partners avoid a write in test_lead_lost sms: any employee can send sms mrp: mrp user can execute wizards give unlink access as making write during do_produce operation base_import: employees can import files delivery: stock user can deliver event_sale: sale user can configure the wizards event user inherit from sale rights gamification: employee can give badge google_service: resolve FIXME hr: add specific rights manager can set a plan according to group on button anyone who can write on an employee can register a departure hr_expense: set rights based on buttons hr_holidays: an approver can make a summary report hr_recruitment: recruiter can refuse a candidate hr_timesheet: can use the wizard if can create a timesheet l10n_eu_service: managers can create fiscal positions mass_mailing: same group as on mass.mailing.list membership: accountant can create invoice from membership payment: accountant can create a link as the source is an account.move keep the payment.acquirer.onboarding.wizard to system user only as it is called during company configuration point_of_sale: PoS manager only can use wizards never create closing_balance_confirm_wizard records product_expiry: stock user has rights on stock.picking product_margin: access from accounting menus repair: same rules as for above models sale: set ir.rule for self wizard only add rule from model introduced in payment to add salesman group sale_crm: saleman can create a quotation from a lead sale_coupon: any saleman can generate coupon add self ir.rule sale_product_configurator: salesman can select product variants snailmail: employee can send letters website: designers can write on website website_crm_partner_assign: same rule as group on action website_sale: sale ACL as for payment.acquirer.onboarding.wizard website_slides: anyone can send invitation base: base.language.*: allow employee (cf lang_install) change.password.user: can not read change password wizard of other users test.*: no access is needed Courtesy of Damien Bouvy, William Andre and Antoine Prieëls for review of acl
2020-01-13[FIX] base: don't hide internal users behind rulesDamien Bouvy
Example: User 1 has access to company A User 2 has access to company B Customer 1 is shared, has user 2 as their Salesperson Try to create a SO for Customer 1 as User 1 => access rights issue, the quote is trying to set User 2 as the salesman of the quote but cannot because of base.res_users_rule This commit makes this flow possible by sharing users if they're not portal. closes odoo/odoo#43190 X-original-commit: ebc8d85d383643c1d4d2aa6723bc7a589c7d1c68 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-01-02[FIX] base: better multi-company rules for partnersDamien Bouvy
Commit d86c2c5883 removed the multi-company partner rule because it interfered with the users rule. Indeed, interference between the user's default company and its corresponding partner's company made it possible to have users that were basically unselectable in relational fields if you were not viewing more than one company at the same time. However, this generates a lot of frustrations and tickets for Odoo users, since having everything shared by default is annoying and a clear departure from the expected behaviour. This commit tries to mitigates this fix's side-effects by re-introducing the multi-company rules but by not applying it to partners who are linked to a non-share user (basically, any partner who has a user that is not a portal user). That way, customers and vendors remain filtered by the multi-company rules and only partners of internal users bypass the rule. This is still a side-effect, and might raise a few eyebrows (why is this partner visible even though it is in another company?), but the trade-off seems to be worth it since it fixes the original issue with a far smaller behaviour change. Fixes #41720. closes odoo/odoo#42592 X-original-commit: 2390ba60b8bd624daaea2e6d4e3fd85ef1b1faeb Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-10-01[FIX] base: res_users in multi companyArnold Moyaux
Usecase to reproduce: - User1 in company A and company B (default company A) - User2 in company A and company B (default company A) As user1 select company B in company switcher. -> You never see user2 as he's hidden by a record rule. This issue was present in older version when disabling the “Common Contact Book” feature, because it was then enabling the faulty record rule. Since [1], this faulty record rule is always enabled. (Note that res.partner record rules are applied to res.user through _inherits) We chose to remove the faulty record rules so that the present usecase is now working, but the drawback is that you now see partners from other companies. Also remove [2] that try to fix the issue and become useless if the rule is removed. [1] commit 25714692b23624d04a43862db26ebcf802b89399 [2] commit d6c65aa4d48ae2bf10830e04a3fb043b06816277 closes odoo/odoo#37712 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-08-28[FIX] base: allow users to read themselves in multicompanyRomainLibert
You should always be able to read your own user whatever the company you are logged into closes odoo/odoo#36190 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-08-20[IMP] models: ORM speedupRaphael Collet
This branch is the combination of several optimizations in the ORM: * store field values once in the cache: the cache reflects more faithfully the database, only fields that explicitly depend on the context have an extra indirection in the cache; * delay recomputations by default: use method `recompute` to explicitly flush out pending recomputations; * delay updates in method `write`: updates are stored in a data structure that can be flushed efficiently to the database with method `flush` (which also flush out recomputations); * make method `modified` take advantage of inverse fields to inverse dependencies; * filter records by evaluating a domain on records in Python; * a computed field with `readonly=False` behaves like a normal field with an onchange method; * computed fields are computed in superuser mode by default. Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien Pinckaers. closes odoo/odoo#35659 Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-16[IMP] base: remove the 'Shared contacts book' general settingPrakash Prajapati
The Common partner contact setting is removed from general settings because its behavior wasn't really clean from a technical point of view (disabling the rule on partner access) and wouldn't work as well with new multi-company logic. The default logic of sharing partner will be kept, but when someone wants to limit partner sharing, he will do so partner by partner, by setting the company_id. Also, the default company_id on a partner will be blank so default partner will be a sharable by multi-company. when the partner is created at the time of user creation then the partner's company will be the same as user's company.and when the partner is created at the time of company creation(partner related to company) then the company of partner will be newly created company. task-2024446 Closes: #35266
2019-05-13[IMP] base: Contextualize the multi companyYannick Tivisse
Purpose ======= Allow the user to select the allowed companies for which he wants to see records on top of selecting his current company. It is confusing for users to see the records from the company he is connected to and the records of the children companies. Instead of using the hierarchy of companies to access records across companies, the user can now select (from his set of allowed companies) the companies for which he wants to access records. /!\ This means that the user will interact with records from company A when in company B. Example: a SO has been created and confirmed in A. When in B, I create the invoice from it. Specifications ============== 1/ Deprecate the parent/children hierarchy on the res.company model. The fields are kept on the res.company model to ensure the retro-compatibility, but won't be used accross the standard code anymore. The only functional usage for this mechanism was to allow to see records from several companies by creating a virtual parent company, which will be possible with the new mechanism. 2/ By default, a user will only see the records of the company he is connected to (or records without a company). (It is still editable by the user if needed). For that, put this information in the user context, to allow having different configurations on different browser tabs. Instead of having domains like ['|', ('company_id', '=', False), ('company_id', 'child_of', user.company_id.id)] you'll have something like ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] Note that the 'company_ids' is a value that is passed in the evaluation context on the record rule, as we already have user, or time. company_ids is a list of the ids of all the enabled companies in the user's context. 3/ Out of the generic improvements brought by this task, this will illustrate issues that could exist since several versions. For example, it should not be possible to create a scrap order for the company A with a package of the company B, or it should not be possible to create an invoice on the company A with payment terms from the company B. Before the version 12.0, it was easy to encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side effect of the fact that the SUPERUSER_ID has become an inactive user was to make it more difficult to introduce mismatch on the records, but haven't solved the issue, as it was still possible to do it with parent companies configuration. Some of these issues have been fixed in this commit, but all the business flows should be re-tested to check if an ir.rule should be introduced (eg: a multi company rule for stock.quand.package), if the company of a record is correctly transfered to another record created from the first record (eg: From a SO, create an invoice and a payment, the company of the sales order should be transfered on the invoice and the payment, even if the company of the sales order is A and I'm logged into the company B with the company A enabled. 4/ Currently, if I click on a button on a notification email (example 'View Task'), I face a traceback if I'm not logged into the company of the record. Now, if you click on a button and if you have access to the record, the correct company will be automatically set. 5/ If I display a kanban view with several records from several companies (and an image), all the images should be displayed. 6/ Currently if you copy paste an url, this will crash if you're not in the correct company. This won't be fixed because it's quite impossible to do it in a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into the correct company, re-copy/paste -> Ok. 7/ 2 property methods have been added on the environment to retrieve the company on which the user is logged in and the companies the user enabled, on a specific tab. That way, when creating a record, instead of doing default=lambda self: self.env.user.company_id do default=lambda self: self.env.company_id On the other hand, to retrieve the enabled companies, do companies = self.env.company_ids 8/ Modify the Company Switcher widget to allow to log into another company WITHOUT writing on the res.users (and thus bringing cache invalidation issues and so on). Also allow to enable several companies and see records from several companies, and independantly of the other browser's tabs. 9/ When focusing on a tab, save the current company configuration on the local storage. That way, when doing 'CTRL+T' or a middle click, the context is propagated to the new tab. 10/ Improve the error message in case of multi company access errors. Now, when the user is in debug mode, display the related names of the records and the name of the user who brings the issue. 11/ Remove the context erasing when writing on a res.users This is probably coming from the migration to new API of the base module. The context was not propagated at this moment, which was a common mistake at that time. When migrating the module, probably by using the 'black box' method, as the context was not propagated, it was erased on the new version. This is now an issue because the context (i.e. the enabled companies) was erased when writing on a res.users, leading to tracebacks. See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624 12/ Fix the crash manager on redirect warnings. The issue is the following - Create an invoice on a company without a configured CoA. - Set a partner - On the onchange_partner_id, a redirect warning is raised to propose you to configure a CoA - Click on 'Go to the configuration panel' - A generic warning says something like 'Do you want to discard your changes?' - Click on yes, the page refreshes, but not on the redirect action. Now, set correctly the action on the hash, and reload instead. The breadcrumb is lost for example, but you reach the correct action at least. 13/ Introduce a res.group to enable/disable the multi company per tab feature. 14/ To help the users to know which tab is in which company, add the possibility to have a favicon per company. When creating a company, the classical 'O' icon is colored by default in a random color. 15/ Remove the company switcher on the frontend. This was mainly there to allow a user to swicth to the company linked to the website. This behavior is now transparent to the user. If the website A is activated, then the company set on the context is the company of the website. 16/ Deprecated the _company_default_get method on the res.company model. Remove the method _get_company on the res.users model. 17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval context. You can now use those variables on domains in the views to access directly to the activated company.ies on the current tab. TaskID: 1960971 closes odoo/odoo#32341 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-02-14[IMP] hr_*: introduce the employee profileLucas Lefèvre
General Purpose =============== We want an 'Employee profile' gathering every data about an employee. The main form view is modified to become this employee profile. A user can also see his own profile through the Preferences menu. The new profile replaces the current Preferences view if the hr module is installed and the current user is linked to an employee. A user should be able to see and edit his own profile. *Problem*: Many fields on hr.employee are protected by groups="hr.group_hr_user". Therefore, a regular user cannot see or edit those fields. This protection must be bypassed to allow read/write access to the regular user's own data. A similar mechanism already exists for res.users (for Preferences) The better (least worst) solution found is to reuse this mechanism by adding related fields on res.users. Pros: - Don't change security access on hr.employee - Don't implement yet another custom security layer, risking to add new security breaches - A lot of fields are added by other modules on hr.employee. It would have required to integrate them with the custom security layer. - Fields added by other modules on the user's preferences view (normal view, not the profile) are automatically included in the employee's profile view. - Allow the hr.employee form view to be different than the user profile accessible through the Preferences menu. E.g. add custom buttons only relevant to the logged in user such as "Request a leave". Cons: - Each field from hr.employee that you want to appear on its profile must be added as a related field on res.users - Those related fields must be added to user's preferences view (duplicate views) - They also must be added to SELF_[READABLE | WRITABLE]_FIELDS Note: When the front-end loads the views it gets the list of available fields for the user (according to its access rights). Later, when the front-end wants to populate the view with data, it only asks to read those available fields. However, in this case, we want the user to be able to read/write its own data, even if they are protected by groups (groups are kept on the related fields on res.users). The front-end need to be made aware of those fields by sending all field definitions. hr_attendance ============= This commit integrate attendance in the new employee profile. It also adds a stat button to this employee profile showing the number of hours worked last month. Remove the boolean computed field 'manual_attendance'. This field is just a shortcut to add/remove the employee's user in the "Manual Attendance" group. The checkbox is confusing on the employee's form and this should be done through the normal group management screens. hr_presence =========== Display the presence status on the employee kanban template. The status is a colored chip which can be green (present), orange (to define) or red (absent). Currently, the presence status is only computed when accessing the report view. As this commits displays it on the employee kanban, it should be updated more frequently. The state should not be updated every time the kanban view is loaded since the computation is a bit heavy. Instead: add a cron to update status every 15 minutes. -> The status is accurate on the report view (status is still updated when loading the view) -> The status in accurate at 15 minutes on the kanban view [ADD] hr_attendance_presence ============================ Bridge module between hr_attendance and hr_presence. This commit integrates hr_presence module in the employee profile and adds the presence status on the employee kanban view. But hr_attendance adds at the same place a similar status icon for checkin/checkout. This bridge module makes the status from hr_presence invisible as hr_attendance should be the main presence control mechanism. Also, this commit adds the ability (through a new setting option) for hr_presence to take into account checkin/checkout to determine the presence status. l10n_be_hr_payroll ================== integration with employee profile
2018-06-15[MERGE] forward port branch saas-11.3 up to 50860317ccdChristophe Simonis
Note: 1aacc962620982528a3dfc90d2c1dd0027359375 has been ignored and will be forward-ported later
2018-06-12[MERGE] forward port branch 11.0 up to e3658d6f568Christophe Simonis
2018-06-12[MERGE] forward port branch saas-15 up to d44cd778844Christophe Simonis
2018-06-11[MERGE] forward port branch 10.0 up to 90326171201Christophe Simonis
2018-06-11[MERGE] forward port branch 9.0 up to 06a085b25faChristophe Simonis
2018-05-29[MERGE] forward port branch saas-11.3 up to 37eed7c509fChristophe Simonis
2018-05-25[MERGE] forward port branch 11.0 up to 2ca72960001Christophe Simonis
2018-05-25[MERGE] forward port branch saas-15 up to dbb2b9bf73dChristophe Simonis
2018-05-24[MERGE] forward port branch 10.0 up to 3051d1dd2feChristophe Simonis
2018-05-24[MERGE] forward port branch 9.0 up to 919a1af9360Christophe Simonis
2018-05-04[IMP] base: Add support for private addressesYannick Tivisse
Purpose ======= Add the possibility to create private addresses, only accessible for a subset of users. Specification ============= - Add a new 'Private' partner type - Add a res.groups in base 'Access to Private Addresses' - Add ir.rules for the following behavior: - Every employees/internal users can read non-private addresses - Only users in group_private_addresses can access private addresses - Add in base a simplified form view for private addresses - A HR Officer is automatically granted in group_private_addresses - Use the simplified form view to open the address_home_id form on employees
2017-11-27[SPLIT] base: split base_security to separate groups from rulesThibault Delavallée
2017-11-27[MOV] base: regroup all security rules in the same file in security/Thibault Delavallée
* get some ir_rules from view files * move all rules into same file
2017-09-15[IMP] mass_mailing: choose model among all chatter modelsYannick Tivisse
This commit removes the strange selection box based on a magic flag and some strange methods returning a string. Instead just allow to send mass mailing on all models inheriting from mail.thread using the is mail thread flag. Various addons are updated to remove the _mail_mass_mailing class attribute used to determine mass mailing capability. We consider people could send a mass mailing on every model inheriting from mail.thread. It makes no sense to limit it to a given set of addons.
2017-08-28[REM] base: remove model `ir.values`Raphael Collet
2017-08-28[ADD] base: model `ir.default` to store user-defined defaultsRaphael Collet
2017-03-23[MOV] base,portal: make portal module emptyJérome Maes
The goal is to prepare the removal of 'portal' module. - demo portal user is moved into base - 'is_portal' field on res.group too - remaining security rule are moved to base too - mail template is moved to website_portal
2017-01-03[REF] ir_config_parameter: remove `group_ids` and simplifyRaphael Collet
Add `sudo()` to call `get_param` where necessary, and make the web client use a controller instead of directly accessing parameters.
2017-01-03[IMP] base, *: tighten `ir.config_parameter` access rightsRaphael Collet
Add `base.group_system` on existing parameters: - `auth_signup.allow_uninvited`, - `auth_signup.reset_password`, - `auth_signup.template_user_id`, - `google_redirect_uri`, - `mail.bounce.alias`, - `mail.catchall.alias`, - `mail.catchall.domain`.
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet