djangocms-blog icon indicating copy to clipboard operation
djangocms-blog copied to clipboard

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

Open corentinbettiol opened this issue 2 years ago • 0 comments

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")?

corentinbettiol avatar Jan 25 '23 13:01 corentinbettiol