Aggiunge modulo Replay, Garage dev e YouTube a livello società.
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>
This commit is contained in:
33
backend/app/services/recordings/access_policy.rb
Normal file
33
backend/app/services/recordings/access_policy.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
Reference in New Issue
Block a user