跳至内容
菜单
此问题已终结
3 回复
2469 查看

I'm currently trying to set up my website to be able to serve as a platform for my community's research. I wish to do this by allowing users to create and edit their blog posts but not those of others.


Currently, I'm unable to find any way to achieve that as allowing creation and writing access to blog posts for users will instantly let them edit all other blog posts. Is there a way to achieve what I'm trying to do?

形象
丢弃
最佳答案

Hi,

To restrict users so they can only edit their own blog posts in Odoo 17 Community, you'll need to create specific access control rules and record rules. Here's a steps to achieve this:


Step 1: Create a New Security Group

1. Log in to your Odoo instance: Ensure you have administrator access.

2. Go to Settings:

   - Navigate to the Settings menu.

   - Activate the developer mode by clicking on your user profile in the top right corner and selecting Activate the developer mode.

3. Access Groups:

   - Go to Settings > Users & Companies > Groups.

   - Click on Create to create a new group.

   - Name the group, for example, "Blog Post Authors".


Step 2: Create Access Control Rules

1. Define Access Rights:

   - While creating the group, go to the Access Rights tab.

   - Add the model `blog.post` and set the permissions for Read, Write, Create and Delete as required.

2. Create Record Rules for Blog Posts:

   - Go to Settings > Technical > Security > Record Rules.

   - Click on Create to add a new record rule. 

3. Record Rule for Blog Post Authors:

   - Name: Only Own Blog Posts

   - Object: blog.post

   - Domain Filter: `[('create_uid', '=', user.id)]`

   - Groups: Select the "Blog Post Authors" group you created.

   - Permissions: Set the permissions to apply the rule for Read, Write, Create, and Delete.

4. Save the Rule:

   - Save the record rule.

Step 4: Assign Users to the New Group

1. Assign Users:

   - Go to Settings > Users & Companies > Users.

   - Select the users you want to restrict.

   - In the Access Rights tab, add them to the "Blog Post Authors" group.


Hope it helps

形象
丢弃
编写者 最佳答案

Thank you for the answers! I followed the steps in Cybrosys Techno Solutions Pvt.Ltd's answer and they work like a charm! The one downside with the setup is that users now can't even view the blog posts of other users but I'm generally fine with that as logging out will sort that out easily. Thanks for the help once again!

形象
丢弃
最佳答案

Hi,
Did you try by adding a record rule for the blog post model ?

Thanks

形象
丢弃
相关帖文 回复 查看 活动
2
6月 22
3220
2
11月 21
2975
2
2月 16
4059
0
7月 24
991
1
7月 24
7344