nephila / djangocms-blog

django CMS blog application - Support for multilingual posts, placeholders, social network meta tags and configurable apphooks
https://djangocms-blog.readthedocs.io
BSD 3-Clause "New" or "Revised" License
391 stars 192 forks source link

Remove Blog toolbar if using multisite and current user does not have the rights to create a blog post on the current site #714

Open corentinbettiol opened 1 year ago

corentinbettiol commented 1 year ago

Description

I would like to remove the Blog toolbar button if a user does not have the rights to create a blog post on the current site.

Use cases

You're a user with the rights to publish blog posts only on a site (site A). You visit another website (site B) that's using the Django/Django-CMS/Djangocms-Blog multisite framework. You go on the blog, and see that the "Blog" toolbar menu is available. You select "Blog" > "Add Post...", and are greeted by a "Add Blog Article" popup. If you only have the rights to post on site A you won't be able to select the website to post the article, so you may think that you're creating a blog post on the current site (site B), when in reality you're creating a blog post on site A.

Proposed solution

Add a condition alongside the self.request.user.has_perm("djangocms_blog.add_post") condition, maybe self.request.user.has_perm("djangocms_blog.add_post_current_site")?