Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devel: only allow adding a blog to planet for staff #491

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions devel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def __str__(self):


def create_feed_model(sender, **kwargs):
allowed_groups = ['Developers', 'Package Maintainers', 'Support Staff']

set_created_field(sender, **kwargs)

obj = kwargs['instance']
Expand All @@ -152,6 +154,11 @@ def create_feed_model(sender, **kwargs):
return

dbmodel = UserProfile.objects.get(id=obj.id)
groups = dbmodel.user.groups.filter(name__in=allowed_groups)

# Only Staff is allowed to publish on planet
if len(groups) == 0:
return

if not obj.website_rss and dbmodel.website_rss:
Feed.objects.filter(website_rss=dbmodel.website_rss).all().delete()
Expand Down
Loading