Skip to content

Commit

Permalink
devel: only allow adding a blog to planet for staff
Browse files Browse the repository at this point in the history
Testers could add a blog and have it post to planet, this does not
represent Arch's Staff.
  • Loading branch information
jelly committed Mar 5, 2024
1 parent 5c1c1ef commit 6ccd4a2
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 6ccd4a2

Please sign in to comment.