Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Forum
Entity: forum.forum
Compute Method: _compute_can_access
| Inputs | Method | Outputs |
|---|---|---|
|
|
+ """Compute the read access of the forums' posts for the current user.""" + if self.env.user._is_admin(): + self.can_access = True + return + if self.env.user.has_group('base.group_public'): + public_forum = self.filtered(lambda f: f.privacy == 'public') + public_forum.can_access = True + (self - public_forum).can_access = False + return + accessible = self.filtered(lambda f: ( + f.privacy in {'public', 'connected'} + or ( + f.privacy == 'private' + and f.authorized_group_id in self.env.user.all_group_ids + ) + )) + accessible.can_access = True + (self - accessible).can_access = False |
|
