fix error when user doesn't own channel and tries to view api keys
This commit is contained in:
parent
77ce480d29
commit
9606889aac
@ -1,11 +1,12 @@
|
|||||||
module ApiKeys
|
module ApiKeys
|
||||||
def api_index (channel_id)
|
def api_index(channel_id)
|
||||||
if current_user && !current_user.channels.find_by_id(channel_id).nil?
|
if current_user && !current_user.channels.find_by_id(channel_id).nil?
|
||||||
@channel = current_user.channels.find(channel_id)
|
@channel = current_user.channels.find(channel_id)
|
||||||
end
|
end
|
||||||
if current_user && current_user.id == @channel.user_id
|
if current_user.present? && @channel.present? && current_user.id == @channel.user_id
|
||||||
@write_key = @channel.api_keys.write_keys.first
|
@write_key = @channel.api_keys.write_keys.first
|
||||||
@read_keys = @channel.api_keys.read_keys
|
@read_keys = @channel.api_keys.read_keys
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user