Manage odoo security
In this section we will learn how to add ir.module.category
, res.groups
, ir.access
, ir.rule
:
Add a new ir.module.category¶
Usage¶
codoo security category [OPTIONS]
Available options¶
Option | Type | Default | Description |
---|---|---|---|
-n, --name | TEXT | The name of the category, (e.g: codoo demo) | |
-d, --description | TEXT | The description of the category | |
-s, --sequence | INTEGER | The sequence of the category, (e.g: 5) | |
-a, --addons | TEXT | The name of the addon (e.g: codoo_demo) | |
--yes | Boolean | False | To confirm the generation |
Note
All the options are mandatory.
Examples¶
codoo security category \
-n "codoo demo" \
-d "Awesome new category generated by codoo cli" \
-s 5 \
-a codoo_demo \
--yes
Add a new res.group¶
Usage¶
codoo security group [OPTIONS]
Available options¶
Option | Type | Default | Description |
---|---|---|---|
-n, --name | TEXT | The name of the group, (e.g: codoo demo manager) | |
-c, --category | TEXT | The name of the category (e.g: codoo_demo_management ) | |
-a, --addons | TEXT | The name of the addon (e.g: codoo_demo) |
Note
All the options are mandatory.
Extra options¶
Option | Type | Default | Description |
---|---|---|---|
Do you want to add implied item ? | BOOLEAN | False | Choose to add an implied item or no |
Operation ? | INTEGER[0-6] | Choose the operation1 type | |
Group id ? | TEXT | The group_id (e.g: base.user_admin) |
Examples¶
codoo security group \
-n "codoo demo manager" \
-c "codoo_demo_management"
-a codoo_demo
Add a new ir.access¶
Usage¶
codoo security access [OPTIONS]
Available options¶
Option | Type | Default | Description |
---|---|---|---|
-a, --addons | TEXT | The name of the addon, (e.g: codoo_demo) | |
-m, --model | TEXT | he name of the model, (e.g: awesome.model) |
Note
All the options are mandatory.
Extra options¶
Option | Type | Default | Description |
---|---|---|---|
Do you want to add new access ? | BOOLEAN | False | Choose to add new access or not |
Which group ? | TEXT | Choose group_id (e.g: codoo_demo_manager) | |
Can read ? | BOOLEAN | True | Choose if user can read |
Can create ? | BOOLEAN | False | Choose if user can create |
Can write ? | BOOLEAN | False | Choose if user can write |
Can unlink ? | BOOLEAN | False | Choose if user can unlink |
Examples¶
codoo security access \
-a codoo_demo \
-m "awesome.model"
Add a new ir.rule¶
Usage¶
codoo security rule [OPTIONS]
Available options¶
Option | Type | Default | Description |
---|---|---|---|
-n, --name | TEXT | The name of the rule, (e.g: Awesome rule) | |
-m, --model | TEXT | The name of the model, (e.g: awesome.model) | |
-a, --addons | TEXT | The name of the addon, (e.g: codoo_demo) | |
-r, --read | Boolean | False | Choose if user can read |
-c, --create | Boolean | False | Choose if user can create |
-w, --write | Boolean | False | Choose if user can write |
-u, --unlink | Boolean | False | Choose if user can unlink |
-d, --domain | TEXT | [] | The domain rule, (e.g: [('user','=', user.id)]) |
Note
All the options are mandatory.
Extra options¶
Option | Type | Default | Description |
---|---|---|---|
Do you want to add new access ? | BOOLEAN | False | Choose to add new access or not |
Operation ? | INTEGER[0-6] | 4 | Choose the operation1 type |
Group id ? | TEXT | The group_id (e.g: base.user_admin) |
Examples¶
codoo security rule \
-n "Awesome rule" \
-m "awesome.model" \
-a codoo_demo \
-r True \
-c False \
-w True \
-u False \
-d "[('user','=', user.id)]"
Currently, we have create a category, group and the necessary permissions was granted, so it's time to pass to the views generation.
-
-
Values: (0, 0, { fields }) create
-
(1, ID, { fields }) update (write fields to ID)
-
(2, ID) remove (calls unlink on ID, that will also delete the relationship because of the ondelete)
-
(3, ID) unlink (delete the relationship between the two objects but does not delete ID)
-
(4, ID) link (add a relationship)
-
(5, ID) unlink all
-
(6, ?, ids) set a list of links
-