Skip to content

Commit 5e36bba

Browse files
committed
Use consistent permissions checking when creating a channel, to ensure that admin users don't get blocked.
1 parent 23e8cdb commit 5e36bba

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

contentcuration/contentcuration/views/internal.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,13 @@ def create_channel(channel_data, user):
471471
# Set up initial channel
472472
channel, isNew = Channel.objects.get_or_create(id=channel_data["id"], actor_id=user.id)
473473

474-
# Add user as editor if channel is new or channel has no editors
475-
# Otherwise, check if user is an editor
476-
if isNew or channel.editors.count() == 0:
474+
# Add user as editor if channel is new
475+
if isNew:
477476
channel.editors.add(user)
478-
elif user not in channel.editors.all():
477+
try:
478+
# Check if user is an editor
479+
channel = Channel.get_editable(user, channel.id)
480+
except Channel.DoesNotExist:
479481
raise SuspiciousOperation("User is not authorized to edit this channel")
480482

481483
extra_fields = channel_data.get('extra_fields') or {}

0 commit comments

Comments
 (0)