- # Clearing the entire permissions cache can generate many
- # unnecessary queries if many active users are not affected by
- # this change. In such cases it would be better to search cached
- # permissions for head_uuid and tail_uuid, and invalidate the
- # cache for only those users. (This would require a browseable
- # cache.)
- User.invalidate_permissions_cache db_current_time.to_i
+ update_permissions tail_uuid, head_uuid, 0, false
+ end
+ end
+
+ def check_permissions
+ if self.link_class == 'permission'
+ update_permissions tail_uuid, head_uuid, 0, true