Pipeline registrazione/upload con storage S3, archivio web e app, proxy replay per il browser, OAuth YouTube sulla pagina club (Premium Full) e footer legale. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
766 B
Ruby
34 lines
766 B
Ruby
module Recordings
|
|
class AccessPolicy
|
|
def initialize(recording, viewer: nil)
|
|
@recording = recording
|
|
@viewer = viewer
|
|
end
|
|
|
|
def allowed?
|
|
return false if @recording.deleted?
|
|
return true if @recording.status == "processing" && (club_member? || manage_allowed?)
|
|
return false unless @recording.ready?
|
|
|
|
return true if @recording.unlisted? || @recording.publicly_listed?
|
|
|
|
club_member?
|
|
end
|
|
|
|
def manage_allowed?
|
|
return false unless @viewer
|
|
|
|
team = @recording.team
|
|
team.club.owned_by?(@viewer) || @viewer.manageable_teams.exists?(id: team.id)
|
|
end
|
|
|
|
private
|
|
|
|
def club_member?
|
|
return false unless @viewer
|
|
|
|
@recording.team.club.users.exists?(id: @viewer.id)
|
|
end
|
|
end
|
|
end
|